+1998-01-26 00:57 Ulrich Drepper <drepper@cygnus.com>
+
+ * db2/Makefile (routines): Add os_alloc.
+ * db2/db.h: Update from db-2.3.16.
+ * db2/db_185.h: Likewise.
+ * db2/db_int.h: Likewise.
+ * db2/btree/bt_close.c: Likewise.
+ * db2/btree/bt_cursor.c: Likewise.
+ * db2/btree/bt_delete.c: Likewise.
+ * db2/btree/bt_open.c: Likewise.
+ * db2/btree/bt_page.c: Likewise.
+ * db2/btree/bt_put.c: Likewise.
+ * db2/btree/bt_rec.c: Likewise.
+ * db2/btree/bt_recno.c: Likewise.
+ * db2/btree/btree_auto.c: Likewise.
+ * db2/common/db_appinit.c: Likewise.
+ * db2/common/db_apprec.c: Likewise.
+ * db2/common/db_err.c: Likewise.
+ * db2/common/db_region.c: Likewise.
+ * db2/common/db_shash.c: Likewise.
+ * db2/db/db.c: Likewise.
+ * db2/db/db_auto.c: Likewise.
+ * db2/db/db_conv.c: Likewise.
+ * db2/db/db_dispatch.c: Likewise.
+ * db2/db/db_dup.c: Likewise.
+ * db2/db/db_pr.c: Likewise.
+ * db2/db/db_rec.c: Likewise.
+ * db2/db185/db185.c: Likewise.
+ * db2/dbm/dbm.c: Likewise.
+ * db2/hash/hash.c: Likewise.
+ * db2/hash/hash_auto.c: Likewise.
+ * db2/hash/hash_dup.c: Likewise.
+ * db2/hash/hash_page.c: Likewise.
+ * db2/hash/hash_rec.c: Likewise.
+ * db2/include/btree_ext.h: Likewise.
+ * db2/include/clib_ext.h: Likewise.
+ * db2/include/common_ext.h: Likewise.
+ * db2/include/db.h.src: Likewise.
+ * db2/include/db_185.h.src: Likewise.
+ * db2/include/db_am.h: Likewise.
+ * db2/include/db_ext.h: Likewise.
+ * db2/include/db_int.h.src: Likewise.
+ * db2/include/hash_ext.h: Likewise.
+ * db2/include/lock_ext.h: Likewise.
+ * db2/include/log.h: Likewise.
+ * db2/include/log_auto.h: Likewise.
+ * db2/include/log_ext.h: Likewise.
+ * db2/include/mp.h: Likewise.
+ * db2/include/mp_ext.h: Likewise.
+ * db2/include/mutex_ext.h: Likewise.
+ * db2/include/os_ext.h: Likewise.
+ * db2/include/os_func.h: Likewise.
+ * db2/include/txn_ext.h: Likewise.
+ * db2/lock/lock.c: Likewise.
+ * db2/lock/lock_util.c: Likewise.
+ * db2/log/log.c: Likewise.
+ * db2/log/log.src: Likewise.
+ * db2/log/log_archive.c: Likewise.
+ * db2/log/log_auto.c: Likewise.
+ * db2/log/log_get.c: Likewise.
+ * db2/log/log_put.c: Likewise.
+ * db2/log/log_rec.c: Likewise.
+ * db2/log/log_register.c: Likewise.
+ * db2/mp/mp_bh.c: Likewise.
+ * db2/mp/mp_fget.c: Likewise.
+ * db2/mp/mp_fopen.c: Likewise.
+ * db2/mp/mp_fput.c: Likewise.
+ * db2/mp/mp_pr.c: Likewise.
+ * db2/mp/mp_sync.c: Likewise.
+ * db2/mutex/mutex.c: Likewise.
+ * db2/os/os_alloc.c: Likewise.
+ * db2/os/os_config.c: Likewise.
+ * db2/os/os_stat.c: Likewise.
+ * db2/progs/db_checkpoint/db_checkpoint.c: Likewise.
+ * db2/progs/db_deadlock/db_deadlock.c: Likewise.
+ * db2/progs/db_load/db_load.c: Likewise.
+ * db2/progs/db_printlog/db_printlog.c: Likewise.
+ * db2/progs/db_recover/db_recover.c: Likewise.
+ * db2/progs/db_stat/db_stat.c: Likewise.
+ * db2/txn/txn.c: Likewise.
+
+ * elf/dl-close.c (_dl_close): Rename inner variable named map to imap.
+ Unmap memory blocks in reverse order of allocation.
+ Call munmap with load address added to offset.
+ Bug reported by Miguel de Icaza.
+
+ * locale/programs/ld-collate.c (collate_end_weight): Correctly fill
+ up weight array.
+
+ * localedata/locales/cs_CZ: Update by Michael Mraka
+ <michael@informatics.muni.cz>.
+
+ * misc/sys/syslog.h: Reformat a bit. Don't declare vsyslog unless
+ __USE_BSD.
+
+ * nis/nss_compat/compat-grp.c: Correctly handle buffer overflow while
+ reading line with fgets.
+ * nis/nss_compat/compat-pwd.c: Likewise.
+ * nis/nss_compat/compat-spwd.c: Likewise.
+ * nss/nss_files/files-XXX.c: Likewise.
+ * nss/nss_files/files-alias.c: Likewise.
+ * shadow/fgetspent_r.c: Likewise.
+
+ * string/strerror_r.c: Correct comment. Patch by Andreas Jaeger.
+
+ * sysdeps/unix/sysv/linux/bits/stat.h: Define _STATBUF_ST_RDEV.
+ * sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
+
+ * sysdeps/unix/sysv/linux/i386/sys/ucontext.h: Allocate room for
+ FP register content in ucontext_t.
+
+1998-01-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * sysdeps/libm-ieee754/s_modfl.c (modf): Correct
+ calculation. Patch by Markus Schoder
+ <Markus.Schoder@dresdner-bank.de>.
+
+ * math/libm-test.c (modf_test): Add more tests for modf.
+
+ * sysdeps/unix/sysv/linux/sys/mman.h: Add const to mlock and
+ munlock according to Unix98.
+
+1998-01-25 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * nss/nss_files/files-network.c (LINE_PARSER): Set n_addrtype to
+ AF_INET.
+
+1998-01-21 07:22 H.J. Lu <hjl@gnu.org>
+
+ * sysdeps/posix/ttyname.c: Handle symbolic links.
+ * sysdeps/posix/ttyname_r.c: Ditto.
+
+1998-01-25 19:39 Ulrich Drepper <drepper@cygnus.com>
+
+ * db2/makedb.c (process_input): Write terminating \0 for value.
+ (print_database): Simply print value string, don't use length.
+
+1998-01-24 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * nss/nsswitch.c (__nss_configure_lookup): Correct test for early
+ exit of loop.
+
+1998-01-25 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * nis/ypclnt.c: Don't set dom_client to NULL, or we will not
+ close all sockets.
+
+1998-01-25 14:54 Ulrich Drepper <drepper@cygnus.com>
+
+ * signal/Makefile (routines): Add sighold, sigrelse, sigignore, and
+ sigset.
+ * signal/sighold.c: New file.
+ * signal/sigrelse.c: New file.
+ * sysdeps/generic/sigignore.c: New file.
+ * sysdeps/generic/sigset.c: New file.
+ * sysdeps/posix/sigignore.c: New file.
+ * sysdeps/posix/sigset.c: New file.
+ * signal/signal.h: Add prototypes for new functions.
+
+ * sysdeps/unix/sysv/linux/alpha/bits/signum.h: Define SIG_HOLD.
+ * sysdeps/unix/sysv/linux/bits/signum.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/signum.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/signum.h: Likewise.
+
+1998-01-23 00:16 Tim Waugh <tim@cyberelk.demon.co.uk>
+
+ * posix/wordexp.c: Added IFS field-splitting in parameter and
+ command substitution. Fixed an IFS-related bug that caused an
+ infinite loop.
+
+1998-01-25 12:38 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdlib/Makefile (routines): Add getcontext, setcontext, makecontext,
+ and swapcontext.
+ * stdlib/ucontext.h: Correct prototypes.
+ * sysdeps/generic/getcontext.c: New file.
+ * sysdeps/generic/setcontext.c: New file.
+ * sysdeps/generic/makecontext.c: New file.
+ * sysdeps/generic/swapcontext.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: Removed.
+
+1998-01-25 04:07 Ulrich Drepper <drepper@cygnus.com>
+
+ * resource/sys/resource.h: Remove #include of ulimit.h which is
+ not allowed by SUSv2 and not available on other systems.
+ * sysdeps/unix/sysv/linux/ulimit.c: Include ulimit.h.
+
+ * streams/Makefile: New file.
+ * streams/stropts.h: New file.
+ * sysdeps/generic/bits/stropts.h: New file.
+ * sysdeps/generic/isastream.c: New file.
+ * sysdeps/generic/getmsg.c: New file.
+ * sysdeps/generic/getpmsg.c: New file.
+ * sysdeps/generic/putmsg.c: New file.
+ * sysdeps/generic/putpmsg.c: New file.
+ * sysdeps/generic/fattach.c: New file.
+ * sysdeps/generic/fdetach.c: New file.
+ * sysdeps/unix/inet/Subdirs: Add streams.
+ * sysdeps/generic/bits/types.h: Add definition of __t_scalar_t and
+ __t_uscalar_t.
+ * sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
+
+ * sysdeps/mach/_strerror.c: Follow changes of generic version to
+ handle small buffers correctly.
+
+1998-01-24 17:31 H.J. Lu <hjl@gnu.org>
+
+ * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
+ Remove the 3rd arg and add declaration for _dl_runtime_resolve
+ and _dl_runtime_profile.
+
+1998-01-25 02:42 Ulrich Drepper <drepper@cygnus.com>
+
+ * include/cpio.h: New file. Mainly copied from GNU cpio.
+ * posix/Makefile (headers): Add cpio.h.
+
1998-01-24 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/Makefile: Distribute nis_cache2.h, add nis cache functions
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _BITS_STROPTS_H
+#define _BITS_STROPTS_H 1
+
+#include <bits/types.h>
+
+/* Macros used as `request' argument to `ioctl'. */
+#define I_PUSH 1 /* Push STREAMS module onto top of the current
+ STREAM, just below the STREAM head. */
+#define I_POP 2 /* Remove STREAMS module from just below the
+ STREAM head. */
+#define I_LOOK 3 /* Retrieve the name of the module just below
+ the STREAM head and place it in a character
+ string. */
+#define I_FLUSH 4 /* Flush all input and/or output. */
+#define I_FLUSHBAND 5 /* Flush only band specified. */
+#define I_SETSIG 6 /* Inform the STREAM head that the process
+ wants the SIGPOLL signal issued. */
+#define I_GETSIG 7 /* Return the events for which the calling
+ process is currently registered to be sent
+ a SIGPOLL signal. */
+#define I_FIND 8 /* Compares the names of all modules currently
+ present in the STREAM to the name pointed to
+ by `arg'. */
+#define I_PEEK 9 /* Allows a process to retrieve the information
+ in the first message on the STREAM head read
+ queue without taking the message off the
+ queue. */
+#define I_SRDOPT 10 /* Sets the read mode. */
+#define I_GRDOPT 11 /* Returns the current read mode setting. */
+#define I_NREAD 12 /* Counts the number of data bytes in the data
+ block in the first message. */
+#define I_FDINSERT 13 /* Create a message from the specified
+ buffer(s), adds information about another
+ STREAM, and send the message downstream. */
+#define I_STR 14 /* Construct an internal STREAMS `ioctl'
+ message and send that message downstream. */
+#define I_SWROPT 15 /* Set the write mode. */
+#define I_GWRSET 16 /* Return the current write mode setting. */
+#define I_SENDFD 17 /* Requests the STREAM associated with `fildes'
+ to send a message, containing a file
+ pointer, to the STREAM head at the other end
+ of a STREAMS pipe. */
+#define I_RECVFD 18 /* Retrieve the file descriptor associated with
+ the message sent by an I_SENDFD `ioctl'
+ over a STREAMS pipe. */
+#define I_LIST 19 /* List all the module names on the STREAM, up
+ to and including the topmost driver name. */
+#define I_ATMARK 20 /* See if the current message on the STREAM
+ head read queue is "marked" by some module
+ downstream. */
+#define I_CKBAND 21 /* Check if the message of a given priority
+ band exists on the STREAM head read
+ queue. */
+#define I_GETBAND 22 /* Return the priority band of the first
+ message on the STREAM head read queue. */
+#define I_CANPUT 23 /* Check if a certain band is writable. */
+#define I_SETCLTIME 24 /* Set the time the STREAM head will delay when
+ a STREAM is closing and there is data on
+ the write queues. */
+#define I_LINK 25 /* Connect two STREAMs. */
+#define I_UNLINK 26 /* Disconnects the two STREAMs. */
+#define I_PLINK 27 /* Connect two STREAMs with a persistent
+ link. */
+#define I_PUNLINK 28 /* Disconnect the two STREAMs that were
+ connected with a persistent link. */
+
+
+/* Used in `I_LOOK' request. */
+#define FMNAMESZ 255
+
+/* Flush options. */
+#define FLUSHR 1 /* Flush read queues. */
+#define FLUSHW 2 /* Flush write queues. */
+#define FLUSHRW 3 /* Flush read and write queues. */
+
+/* Possible arguments for `I_SETSIG'. */
+#define S_RDNORM 0x0001 /* A normal message has arrived. */
+#define S_RDBAND 0x0002 /* A message with a non-zero priority has
+ arrived. */
+#define S_INPUT 0x0004 /* A message, other than a high-priority
+ message, has arrived. */
+#define S_HIPRI 0x0008 /* A high-priority message is present. */
+#define S_OUTPUT 0x0010 /* The write queue for normal data is no longer
+ full. */
+#define S_WRNORM S_OUTPUT
+#define S_WRBAND 0x0020 /* The write queue for a non-zero priority
+ band is no longer full. */
+#define S_MSG 0x0040 /* A STREAMS signal message that contains the
+ SIGPOLL signal reaches the front of the
+ STREAM head read queue. */
+#define S_ERROR 0x0080 /* Notification of an error condition. */
+#define S_HANGUP 0x0100 /* Notification of a hangup. */
+#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
+ SIGURG is generated instead of SIGPOLL when
+ a priority message reaches the front of the
+ STREAM head read queue. */
+
+/* Option for `I_PEEK'. */
+#define RS_HIPRI 1 /* Only look for high-priority messages. */
+
+/* Options for `I_SRDOPT'. */
+#define RDNORM 1 /* Byte-STREAM mode, the default. */
+#define RMSGD 2 /* Message-discard mode. */
+#define RMSGN 3 /* Message-nondiscard mode. */
+#define RPROTNORM 4 /* Fail `read' with EBADMSG if a message
+ containing a control part is at the front
+ of the STREAM head read queue. */
+#define RPROTDAT 5 /* Deliver the control part of a message as
+ data. */
+#define RPROTDIS 6 /* Discard the control part of a message,
+ delivering any data part. */
+
+/* Possible mode for `I_SWROPT'. */
+#define SNDZERO 1 /* Send a zero-length message downstream when a
+ `write' of 0 bytes occurs. */
+
+/* Arguments for `I_ATMARK'. */
+#define ANYMARK 1 /* Check if the message is marked. */
+#define LASTMARK 2 /* Check if the message is the last one marked
+ on the queue. */
+
+/* Argument for `I_UNLINK'. */
+#define MUXID_ALL 1 /* Unlink all STREAMs linked to the STREAM
+ associated with `fildes'. */
+
+
+/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
+#define MSG_ANY 1 /* Receive any message. */
+#define MSG_BAND 2 /* Receive message from specified band. */
+#define MSG_HIPRI 3 /* Send/receive high priority message. */
+#define MORECTL 4 /* More control information is left in
+ message. */
+#define MOREDATA 5 /* More data is left in message. */
+
+
+/* Structure used for the I_FLUSHBAND ioctl on streams. */
+struct bandinfo
+ {
+ unsigned char bi_pri;
+ int bi_flag;
+ };
+
+struct strbuf
+ {
+ int maxlen; /* Maximum buffer length. */
+ int len; /* Length of data. */
+ char *buf; /* Pointer to buffer. */
+ };
+
+struct strpeek
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ __t_uscalar_t flags;
+ };
+
+struct strfdinsert
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ __t_uscalar_t flags;
+ int fildes;
+ int offset;
+ };
+
+struct strioctl
+ {
+ int ic_cmd;
+ int ic_timout;
+ int ic_len;
+ char *ic_dp;
+ };
+
+struct strrecvfd
+ {
+ int fd;
+ __uid_t uid;
+ __gid_t gid;
+ };
+
+
+struct str_mlist
+ {
+ char l_name[FMNAMESZ + 1];
+ };
+
+struct str_list
+ {
+ int sl_nmods;
+ struct str_mlist *sl_modlist;
+ };
+
+#endif /* bits/stropts.h */
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
typedef unsigned long int __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
bt_open bt_page bt_put bt_rec bt_recno bt_rsearch bt_search \
bt_split bt_stat btree_auto db db_appinit db_apprec \
db_auto \
- db_byteorder db_conv db_dispatch db_dup db_err db_log2 \
+ db_byteorder db_conv db_dispatch db_dup db_err db_log2 os_alloc \
os_abs os_config os_dir os_fid os_fsync os_map os_oflags \
os_open os_rpath os_rw os_seek os_sleep os_stat os_unlink \
os_spin db_overflow db_pr db_rec db_region db_ret db_salloc \
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_close.c 10.24 (Sleepycat) 9/17/97";
+static const char sccsid[] = "@(#)bt_close.c 10.25 (Sleepycat) 1/6/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
{
BTREE *t;
BTMETA *meta;
- DB_LOCK mlock;
+ DB_LOCK metalock;
db_pgno_t pgno;
int flags, ret;
pgno = PGNO_METADATA;
/* Lock and retrieve the page. */
- if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock) != 0)
+ if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock) != 0)
return;
if (__bam_pget(dbp, (PAGE **)&meta, &pgno, 0) == 0) {
/* Log the change. */
}
err: (void)memp_fput(dbp->mpf, (PAGE *)meta, flags);
- (void)__BT_LPUT(dbp, mlock);
+ (void)__BT_LPUT(dbp, metalock);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_cursor.c 10.37 (Sleepycat) 11/22/97";
+static const char sccsid[] = "@(#)bt_cursor.c 10.41 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
CURSOR *cp;
int ret;
- cp = dbc->internal;
+ /*
+ * All cursors are queued from the master DB structure. For
+ * now, discard the DB handle which triggered this call, and
+ * replace it with the cursor's reference.
+ */
+ dbp = dbc->dbp;
/* If a cursor key was deleted, perform the actual deletion. */
+ cp = dbc->internal;
ret = F_ISSET(cp, C_DELETED) ? __bam_c_physdel(dbp, cp, NULL) : 0;
/* Discard any lock if we're not inside a transaction. */
if (cp->lock != LOCK_INVALID)
(void)__BT_TLPUT(dbp, cp->lock);
- /*
- * All cursors are queued from the master DB structure. Remove the
- * cursor from that queue.
- */
- DB_THREAD_LOCK(dbc->dbp);
- TAILQ_REMOVE(&dbc->dbp->curs_queue, dbc, links);
- DB_THREAD_UNLOCK(dbc->dbp);
+ /* Remove the cursor from the queue. */
+ DB_THREAD_LOCK(dbp);
+ TAILQ_REMOVE(&dbp->curs_queue, dbc, links);
+ DB_THREAD_UNLOCK(dbp);
/* Discard the structures. */
FREE(dbc->internal, sizeof(CURSOR));
db_recno_t recno;
int exact, ret;
+ COMPQUIET(flags, 0);
+
/* Get the page with the current item on it. */
if ((ret = __bam_pget(dbp, &cp->page, &cp->pgno, 0)) != 0)
return (ret);
/*
* __bam_cprint --
* Display the current btree cursor list.
+ *
+ * PUBLIC: int __bam_cprint __P((DB *));
*/
int
__bam_cprint(dbp)
* __bam_ca_move --
* Adjust the cursors when moving data items to another page.
*
- * PUBLIC: void __bam_ca_move __P((DB *, BTREE *, db_pgno_t, db_pgno_t));
+ * PUBLIC: void __bam_ca_move __P((DB *, db_pgno_t, db_pgno_t));
*/
void
-__bam_ca_move(dbp, t, fpgno, tpgno)
+__bam_ca_move(dbp, fpgno, tpgno)
DB *dbp;
- BTREE *t;
db_pgno_t fpgno, tpgno;
{
CURSOR *cp;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_delete.c 10.23 (Sleepycat) 11/22/97";
+static const char sccsid[] = "@(#)bt_delete.c 10.25 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
db_recno_t rcnt;
int ret;
- rcnt = 0; /* XXX: Shut the compiler up. */
+ COMPQUIET(rcnt, 0);
+
epg = t->bt_sp;
/*
++t->lstat.bt_freed;
/* Adjust the cursors. */
- __bam_ca_move(dbp, t, h->pgno, PGNO_ROOT);
+ __bam_ca_move(dbp, h->pgno, PGNO_ROOT);
}
/* Release the top page in the subtree. */
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_open.c 10.21 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)bt_open.c 10.22 (Sleepycat) 1/6/98";
#endif /* not lint */
/*
{
BTMETA *meta;
PAGE *root;
- DB_LOCK mlock, rlock;
+ DB_LOCK metalock, rootlock;
db_pgno_t pgno;
int ret;
/* Get, and optionally create the metadata page. */
pgno = PGNO_METADATA;
if ((ret =
- __bam_lget(dbp, 0, PGNO_METADATA, DB_LOCK_WRITE, &mlock)) != 0)
+ __bam_lget(dbp, 0, PGNO_METADATA, DB_LOCK_WRITE, &metalock)) != 0)
return (ret);
if ((ret =
__bam_pget(dbp, (PAGE **)&meta, &pgno, DB_MPOOL_CREATE)) != 0) {
- (void)__BT_LPUT(dbp, mlock);
+ (void)__BT_LPUT(dbp, metalock);
return (ret);
}
t->bt_minkey = meta->minkey;
(void)memp_fput(dbp->mpf, (PAGE *)meta, 0);
- (void)__BT_LPUT(dbp, mlock);
+ (void)__BT_LPUT(dbp, metalock);
return (0);
}
/* Create and initialize a root page. */
pgno = PGNO_ROOT;
- if ((ret = __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_WRITE, &rlock)) != 0)
+ if ((ret =
+ __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_WRITE, &rootlock)) != 0)
return (ret);
if ((ret = __bam_pget(dbp, &root, &pgno, DB_MPOOL_CREATE)) != 0) {
- (void)__BT_LPUT(dbp, rlock);
+ (void)__BT_LPUT(dbp, rootlock);
return (ret);
}
P_INIT(root, dbp->pgsize, PGNO_ROOT, PGNO_INVALID,
ret = EINVAL;
/* Release the locks. */
- (void)__BT_LPUT(dbp, mlock);
- (void)__BT_LPUT(dbp, rlock);
+ (void)__BT_LPUT(dbp, metalock);
+ (void)__BT_LPUT(dbp, rootlock);
return (ret);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_page.c 10.5 (Sleepycat) 8/18/97";
+static const char sccsid[] = "@(#)bt_page.c 10.7 (Sleepycat) 1/7/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
PAGE **pagepp;
{
BTMETA *meta;
- DB_LOCK mlock;
+ DB_LOCK metalock;
PAGE *h;
db_pgno_t pgno;
int ret;
meta = NULL;
h = NULL;
- mlock = LOCK_INVALID;
+ metalock = LOCK_INVALID;
pgno = PGNO_METADATA;
- if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock)) != 0)
+ if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock)) != 0)
goto err;
if ((ret = __bam_pget(dbp, (PAGE **)&meta, &pgno, 0)) != 0)
goto err;
}
(void)memp_fput(dbp->mpf, (PAGE *)meta, DB_MPOOL_DIRTY);
- (void)__BT_TLPUT(dbp, mlock);
+ (void)__BT_TLPUT(dbp, metalock);
P_INIT(h, dbp->pgsize, h->pgno, PGNO_INVALID, PGNO_INVALID, 0, type);
*pagepp = h;
(void)memp_fput(dbp->mpf, h, 0);
if (meta != NULL)
(void)memp_fput(dbp->mpf, meta, 0);
- if (mlock != LOCK_INVALID)
- (void)__BT_TLPUT(dbp, mlock);
+ if (metalock != LOCK_INVALID)
+ (void)__BT_TLPUT(dbp, metalock);
return (ret);
}
{
BTMETA *meta;
DBT ldbt;
- DB_LOCK mlock;
+ DB_LOCK metalock;
db_pgno_t pgno;
int is_dirty, ret, t_ret;
*/
is_dirty = 0;
pgno = PGNO_METADATA;
- if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock)) != 0)
+ if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock)) != 0)
goto err;
if ((ret = __bam_pget(dbp, (PAGE **)&meta, &pgno, 0)) != 0) {
- (void)__BT_TLPUT(dbp, mlock);
+ (void)__BT_TLPUT(dbp, metalock);
goto err;
}
dbp->txn, &meta->lsn, 0, dbp->log_fileid, h->pgno,
&meta->lsn, &ldbt, meta->free)) != 0) {
(void)memp_fput(dbp->mpf, (PAGE *)meta, 0);
- (void)__BT_TLPUT(dbp, mlock);
+ (void)__BT_TLPUT(dbp, metalock);
return (ret);
}
LSN(h) = LSN(meta);
/* Discard the metadata page. */
ret = memp_fput(dbp->mpf, (PAGE *)meta, DB_MPOOL_DIRTY);
- if ((t_ret = __BT_TLPUT(dbp, mlock)) != 0)
+ if ((t_ret = __BT_TLPUT(dbp, metalock)) != 0)
ret = t_ret;
/* Discard the caller's page reference. */
/*
* __bam_lt --
* Print out the list of currently held locks.
+ *
+ * PUBLIC: int __bam_lt __P((DB *));
*/
int
__bam_lt(dbp)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_put.c 10.35 (Sleepycat) 11/22/97";
+static const char sccsid[] = "@(#)bt_put.c 10.38 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
static int __bam_ndup __P((DB *, PAGE *, u_int32_t));
static int __bam_ovput __P((DB *, PAGE *, u_int32_t, DBT *));
static int __bam_partial __P((DB *, DBT *, PAGE *, u_int32_t, u_int32_t));
-static u_int32_t
- __bam_partsize __P((DB *, DBT *, PAGE *, u_int32_t));
+static u_int32_t __bam_partsize __P((DBT *, PAGE *, u_int32_t));
/*
* __bam_put --
u_int32_t data_size, have_bytes, need_bytes, needed;
int bigkey, bigdata, dupadjust, replace, ret;
+ COMPQUIET(bk, NULL);
+
t = dbp->internal;
h = *hp;
indx = *indxp;
-
- bk = NULL; /* XXX: Shut the compiler up. */
dupadjust = replace = 0;
/*
*/
bigkey = LF_ISSET(BI_NEWKEY) && key->size > t->bt_ovflsize;
data_size = F_ISSET(data, DB_DBT_PARTIAL) ?
- __bam_partsize(dbp, data, h, indx) : data->size;
+ __bam_partsize(data, h, indx) : data->size;
bigdata = data_size > t->bt_ovflsize;
needed = 0;
/*
* 5. Delete/re-add the data item.
*
- * If we're dealing with offpage items, we have to
+ * If we're dealing with offpage items, we have to
* delete and then re-add the item.
*/
if (bigdata || B_TYPE(bk->type) != B_KEYDATA) {
* Figure out how much space a partial data item is in total.
*/
static u_int32_t
-__bam_partsize(dbp, data, h, indx)
- DB *dbp;
+__bam_partsize(data, h, indx)
DBT *data;
PAGE *h;
u_int32_t indx;
int ret;
u_int8_t *p;
- bo = NULL; /* XXX: Shut the compiler up. */
+ COMPQUIET(bo, NULL);
+
t = dbp->internal;
/* We use the record data return memory, it's only a short-term use. */
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_rec.c 10.17 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)bt_rec.c 10.18 (Sleepycat) 12/15/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
*/
pgno = PGNO_METADATA;
if ((ret = memp_fget(mpf, &pgno, 0, &meta)) != 0) {
+ /* The metadata page must always exist. */
(void)__db_pgerr(file_dbp, pgno);
goto out;
}
if ((ret = memp_fget(mpf, &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) {
+ /*
+ * We specify creation and check for it later, because this
+ * operation was supposed to create the page, and even in
+ * the undo case it's going to get linked onto the freelist
+ * which we're also fixing up.
+ */
(void)__db_pgerr(file_dbp, argp->pgno);
(void)memp_fput(mpf, meta, 0);
goto out;
* we're undoing the operation, we get the page and restore its header.
*/
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ /*
+ * We don't automatically create the page. The only way the
+ * page might not exist is if the alloc never happened, and
+ * the only way the alloc might never have happened is if we
+ * are undoing, in which case there's no reason to create the
+ * page.
+ */
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
goto out;
}
*/
pgno = PGNO_METADATA;
if ((ret = memp_fget(mpf, &pgno, 0, &meta)) != 0) {
+ /* The metadata page must always exist. */
(void)__db_pgerr(file_dbp, pgno);
goto out;
}
goto out;
}
- *lsnp = argp->prev_lsn;
+done: *lsnp = argp->prev_lsn;
ret = 0;
out: REC_CLOSE;
* interest only if it wasn't a root split -- inserting a new
* page in the tree requires that any following page have its
* previous-page pointer updated to our new page. The next
- * page had better exist.
+ * page must exist because we're redoing the operation.
*/
if (!rootsplit && !IS_ZERO_LSN(argp->nlsn)) {
if ((ret = memp_fget(mpf, &argp->npgno, 0, &np)) != 0) {
} else {
/*
* If the split page is wrong, replace its contents with the
- * logged page contents. The split page had better exist.
+ * logged page contents. If the page doesn't exist, it means
+ * that the create of the page never happened, nor did any of
+ * the adds onto the page that caused the split, and there's
+ * really no undo-ing to be done.
*/
if ((ret = memp_fget(mpf, &pgno, 0, &pp)) != 0) {
- (void)__db_pgerr(file_dbp, pgno);
pp = NULL;
- goto out;
+ goto lrundo;
}
if (log_compare(lsnp, &LSN(pp)) == 0) {
memcpy(pp, argp->pg.data, argp->pg.size);
}
/*
- * If it's a root split and the left child ever existed, put
- * it on the free list. (If it's not a root split, we just
- * updated the left page -- it's the same as the split page.)
- * If the right child ever existed, root split or not, put it
- * on the free list.
+ * If it's a root split and the left child ever existed, update
+ * its LSN. (If it's not a root split, we've updated the left
+ * page already -- it's the same as the split page.) If the
+ * right child ever existed, root split or not, update its LSN.
+ * The undo of the page allocation(s) will restore them to the
+ * free list.
*/
- if ((rootsplit && lp != NULL) || rp != NULL) {
+lrundo: if ((rootsplit && lp != NULL) || rp != NULL) {
if (rootsplit && lp != NULL &&
log_compare(lsnp, &LSN(lp)) == 0) {
lp->lsn = argp->llsn;
* Finally, undo the next-page link if necessary. This is of
* interest only if it wasn't a root split -- inserting a new
* page in the tree requires that any following page have its
- * previous-page pointer updated to our new page. The next
- * page had better exist.
+ * previous-page pointer updated to our new page. Since it's
+ * possible that the next-page never existed, we ignore it as
+ * if there's nothing to undo.
*/
if (!rootsplit && !IS_ZERO_LSN(argp->nlsn)) {
if ((ret = memp_fget(mpf, &argp->npgno, 0, &np)) != 0) {
- (void)__db_pgerr(file_dbp, argp->npgno);
np = NULL;
- goto out;
+ goto done;
}
if (log_compare(lsnp, &LSN(np)) == 0) {
PREV_PGNO(np) = argp->left;
}
}
-done: ret = 0;
- *lsnp = argp->prev_lsn;
+done: *lsnp = argp->prev_lsn;
+ ret = 0;
if (0) {
fatal: (void)__db_panic(file_dbp);
/* Fix the root page. */
pgno = PGNO_ROOT;
if ((ret = memp_fget(mpf, &pgno, 0, &pagep)) != 0) {
+ /* The root page must always exist. */
__db_pgerr(file_dbp, pgno);
- pagep = NULL;
goto out;
}
modified = 0;
goto out;
}
- /* Fix the page copied over the root page. */
+ /*
+ * Fix the page copied over the root page. It's possible that the
+ * page never made it to disk, so if we're undo-ing and the page
+ * doesn't exist, it's okay and there's nothing further to do.
+ */
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
- pagep = NULL;
goto out;
}
modified = 0;
goto out;
}
+done: *lsnp = argp->prev_lsn;
ret = 0;
- *lsnp = argp->prev_lsn;
out: REC_CLOSE;
}
REC_PRINT(__bam_adj_print);
REC_INTRO(__bam_adj_read);
+ /* Get the page; if it never existed and we're undoing, we're done. */
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
- pagep = NULL;
goto out;
}
LSN(pagep) = argp->lsn;
modified = 1;
}
- if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) == 0)
- *lsnp = argp->prev_lsn;
+ if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0)
+ goto out;
+
+done: *lsnp = argp->prev_lsn;
+ ret = 0;
if (0) {
err: (void)memp_fput(mpf, pagep, 0);
REC_PRINT(__bam_cadjust_print);
REC_INTRO(__bam_cadjust_read);
+ /* Get the page; if it never existed and we're undoing, we're done. */
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
- pagep = NULL;
goto out;
}
LSN(pagep) = argp->lsn;
modified = 1;
}
- if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) == 0)
- *lsnp = argp->prev_lsn;
+ if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0)
+ goto out;
+
+done: *lsnp = argp->prev_lsn;
+ ret = 0;
out: REC_CLOSE;
}
REC_PRINT(__bam_cdel_print);
REC_INTRO(__bam_cdel_read);
+ /* Get the page; if it never existed and we're undoing, we're done. */
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
- pagep = NULL;
goto out;
}
LSN(pagep) = argp->lsn;
modified = 1;
}
- if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) == 0)
- *lsnp = argp->prev_lsn;
+ if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0)
+ goto out;
+
+done: *lsnp = argp->prev_lsn;
+ ret = 0;
out: REC_CLOSE;
}
REC_PRINT(__bam_repl_print);
REC_INTRO(__bam_repl_read);
+ /* Get the page; if it never existed and we're undoing, we're done. */
if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) {
+ if (!redo)
+ goto done;
(void)__db_pgerr(file_dbp, argp->pgno);
- pagep = NULL;
goto out;
}
bk = GET_BKEYDATA(pagep, argp->indx);
LSN(pagep) = argp->lsn;
modified = 1;
}
- if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) == 0)
- *lsnp = argp->prev_lsn;
+ if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0)
+ goto out;
+
+done: *lsnp = argp->prev_lsn;
+ ret = 0;
if (0) {
err: (void)memp_fput(mpf, pagep, 0);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_recno.c 10.22 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)bt_recno.c 10.26 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
RECNO *rp;
int ret;
+ COMPQUIET(type, DB_RECNO);
+
ret = 0;
/* Allocate and initialize the private RECNO structure. */
DBC *dbc;
{
/*
- * All cursors are queued from the master DB structure. Remove the
- * cursor from that queue.
+ * All cursors are queued from the master DB structure. For
+ * now, discard the DB handle which triggered this call, and
+ * replace it with the cursor's reference.
*/
- DB_THREAD_LOCK(dbc->dbp);
- TAILQ_REMOVE(&dbc->dbp->curs_queue, dbc, links);
- DB_THREAD_UNLOCK(dbc->dbp);
+ dbp = dbc->dbp;
+
+ /* Remove the cursor from the queue. */
+ DB_THREAD_LOCK(dbp);
+ TAILQ_REMOVE(&dbp->curs_queue, dbc, links);
+ DB_THREAD_UNLOCK(dbp);
/* Discard the structures. */
FREE(dbc->internal, sizeof(RCURSOR));
/*
* __ram_cprint --
* Display the current recno cursor list.
+ *
+ * PUBLIC: int __ram_cprint __P((DB *));
*/
int
__ram_cprint(dbp)
RECNO *rp;
const char *fname;
{
- off_t size;
+ size_t size;
+ u_int32_t mbytes, bytes;
int oflags, ret;
if ((ret = __db_appname(dbp->dbenv,
* compiler will perpetrate, doing the comparison in a portable way is
* flatly impossible. Hope that mmap fails if the file is too large.
*/
- if ((ret = __db_ioinfo(rp->re_source, rp->re_fd, &size, NULL)) != 0) {
+ if ((ret = __db_ioinfo(rp->re_source,
+ rp->re_fd, &mbytes, &bytes, NULL)) != 0) {
__db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret));
goto err;
}
- if (size == 0) {
+ if (mbytes == 0 && bytes == 0) {
F_SET(rp, RECNO_EOF);
return (0);
}
+ size = mbytes * MEGABYTE + bytes;
if ((ret = __db_map(rp->re_fd, (size_t)size, 1, 1, &rp->re_smap)) != 0)
goto err;
rp->re_cmap = rp->re_smap;
}
memset(pad, rp->re_pad, rp->re_len);
} else
- pad = NULL; /* XXX: Shut the compiler up. */
+ COMPQUIET(pad, NULL);
for (keyno = 1;; ++keyno) {
switch (ret = dbp->get(dbp, NULL, &key, &data, 0)) {
case 0:
/*
* PUBLIC: int __bam_pg_free_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, DBT *,
+ * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, const DBT *,
* PUBLIC: db_pgno_t));
*/
int __bam_pg_free_log(logp, txnid, ret_lsnp, flags,
u_int32_t fileid;
db_pgno_t pgno;
DB_LSN * meta_lsn;
- DBT *header;
+ const DBT *header;
db_pgno_t next;
{
DBT logrec;
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
* PUBLIC: DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *,
- * PUBLIC: DBT *));
+ * PUBLIC: const DBT *));
*/
int __bam_split_log(logp, txnid, ret_lsnp, flags,
fileid, left, llsn, right, rlsn, indx,
u_int32_t indx;
db_pgno_t npgno;
DB_LSN * nlsn;
- DBT *pg;
+ const DBT *pg;
{
DBT logrec;
DB_LSN *lsnp, null_lsn;
/*
* PUBLIC: int __bam_rsplit_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t, db_pgno_t, DBT *, db_pgno_t,
- * PUBLIC: DBT *, DB_LSN *));
+ * PUBLIC: u_int32_t, db_pgno_t, const DBT *, db_pgno_t,
+ * PUBLIC: const DBT *, DB_LSN *));
*/
int __bam_rsplit_log(logp, txnid, ret_lsnp, flags,
fileid, pgno, pgdbt, nrec, rootent, rootlsn)
u_int32_t flags;
u_int32_t fileid;
db_pgno_t pgno;
- DBT *pgdbt;
+ const DBT *pgdbt;
db_pgno_t nrec;
- DBT *rootent;
+ const DBT *rootent;
DB_LSN * rootlsn;
{
DBT logrec;
* PUBLIC: int __bam_repl_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t, DBT *, DBT *, u_int32_t,
+ * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t,
* PUBLIC: u_int32_t));
*/
int __bam_repl_log(logp, txnid, ret_lsnp, flags,
DB_LSN * lsn;
u_int32_t indx;
u_int32_t isdeleted;
- DBT *orig;
- DBT *repl;
+ const DBT *orig;
+ const DBT *repl;
u_int32_t prefix;
u_int32_t suffix;
{
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_appinit.c 10.37 (Sleepycat) 11/25/97";
+static const char sccsid[] = "@(#)db_appinit.c 10.38 (Sleepycat) 1/7/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
{
FILE *fp;
int ret;
- char *lp, **p, buf[MAXPATHLEN * 2];
+ char * const *p;
+ char *lp, buf[MAXPATHLEN * 2];
/* Validate arguments. */
if (dbenv == NULL)
goto err;
/* Parse the config array. */
- for (p = (char **)db_config; p != NULL && *p != NULL; ++p)
+ for (p = db_config; p != NULL && *p != NULL; ++p)
if ((ret = __db_parse(dbenv, *p)) != 0)
goto err;
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_apprec.c 10.19 (Sleepycat) 11/23/97";
+static const char sccsid[] = "@(#)db_apprec.c 10.23 (Sleepycat) 1/17/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
+#include <errno.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
{
DBT data;
DB_LOG *lp;
- DB_LSN ckp_lsn, first_lsn, lsn, tmp_lsn;
+ DB_LSN ckp_lsn, first_lsn, lsn;
time_t now;
- int first_flag, is_thread, ret;
+ int is_thread, ret;
void *txninfo;
lp = dbenv->lg_info;
F_CLR(lp, DB_AM_THREAD);
/*
- * Read forward through the log, opening the appropriate files so that
- * we can call recovery routines. In general, we start at the last
- * checkpoint prior to the last checkpointed LSN. For catastrophic
- * recovery, we begin at the first LSN that appears in any log file
- * (log_get figures this out for us when we pass it the DB_FIRST flag).
+ * Recovery is done in three passes:
+ * Pass #1:
+ * Read forward through the log from the last checkpoint to the
+ * end of the log, opening and closing files so that at the end
+ * of the log we have the "current" set of files open.
+ * Pass #2:
+ * Read backward through the log undoing any uncompleted TXNs.
+ * If doing catastrophic recovery, we read to the beginning of
+ * the log, otherwise, to the most recent checkpoint that occurs
+ * before the most recent checkpoint LSN, which is returned by
+ * __log_findckp(). During this pass, checkpoint file information
+ * is ignored, and file openings and closings are undone.
+ * Pass #3:
+ * Read forward through the log from the LSN found in pass #2,
+ * redoing any committed TXNs. During this pass, checkpoint
+ * file information is ignored, and file openings and closings
+ * are redone.
*/
- if (LF_ISSET(DB_RECOVER_FATAL))
- first_flag = DB_FIRST;
- else {
- if ((ret = __log_findckp(lp, &lsn)) == DB_NOTFOUND)
- goto out;
- first_flag = DB_SET;
- }
- /* If we're a threaded application, we have to allocate space. */
+ /*
+ * Find the last checkpoint in the log. This is the point from which
+ * we want to begin pass #1 (the TXN_OPENFILES pass).
+ */
memset(&data, 0, sizeof(data));
- if ((ret = log_get(lp, &lsn, &data, first_flag)) != 0) {
- __db_err(dbenv, "Failure: unable to get log record");
- if (first_flag == DB_SET)
- __db_err(dbenv, "Retrieving LSN %lu %lu",
- (u_long)lsn.file, (u_long)lsn.offset);
- else
- __db_err(dbenv, "Retrieving first LSN");
- goto out;
+ if ((ret = log_get(lp, &ckp_lsn, &data, DB_CHECKPOINT)) != 0) {
+ /*
+ * If we don't find a checkpoint, start from the beginning.
+ * If that fails, we're done. Note, we require that there
+ * be log records if we're performing recovery, and fail if
+ * there aren't.
+ */
+ if ((ret = log_get(lp, &ckp_lsn, &data, DB_FIRST)) != 0) {
+ __db_err(dbenv, "First log record not found");
+ if (ret == DB_NOTFOUND)
+ ret = EINVAL;
+ goto out;
+ }
}
- first_lsn = lsn;
+ /*
+ * Now, ckp_lsn is either the lsn of the last checkpoint or the lsn
+ * of the first record in the log. Begin the TXN_OPENFILES pass from
+ * that lsn, and proceed to the end of the log.
+ */
+ lsn = ckp_lsn;
for (;;) {
ret = __db_dispatch(lp, &data, &lsn, TXN_OPENFILES, txninfo);
if (ret != 0 && ret != DB_TXN_CKP)
goto msgerr;
- if ((ret =
- log_get(dbenv->lg_info, &lsn, &data, DB_NEXT)) != 0) {
- if (ret != DB_NOTFOUND)
- goto out;
- break;
+ if ((ret = log_get(lp, &lsn, &data, DB_NEXT)) != 0) {
+ if (ret == DB_NOTFOUND)
+ break;
+ goto out;
}
}
/*
- * Initialize the ckp_lsn to 0,0. If we never find a valid
- * checkpoint in the log, then leaving ckp_lsn at 0,0 is correct.
+ * Pass #2.
+ *
+ * Before we can begin pass #2, backward roll phase, we determine how
+ * far back in the log to recover. If we are doing catastrophic
+ * recovery, then we go as far back as we have files. If we are
+ * doing normal recovery, we go as back to the most recent checkpoint
+ * that occurs before the most recent checkpoint LSN.
*/
- ZERO_LSN(ckp_lsn);
+ if (LF_ISSET(DB_RECOVER_FATAL)) {
+ ZERO_LSN(first_lsn);
+ } else
+ if ((ret = __log_findckp(lp, &first_lsn)) == DB_NOTFOUND) {
+ /*
+ * If recovery was specified, there must be log files.
+ * If we don't find one, it's an error. (This should
+ * have been caught above, when a log_get() of DB_FIRST
+ * or DB_CHECKPOINT succeeded, but paranoia is good.)
+ */
+ ret = EINVAL;
+ goto out;
+ }
for (ret = log_get(lp, &lsn, &data, DB_LAST);
ret == 0 && log_compare(&lsn, &first_lsn) > 0;
- ret = log_get(lp,&lsn, &data, DB_PREV)) {
- tmp_lsn = lsn;
+ ret = log_get(lp, &lsn, &data, DB_PREV)) {
ret = __db_dispatch(lp,
&data, &lsn, TXN_BACKWARD_ROLL, txninfo);
- if (ret == DB_TXN_CKP) {
- if (IS_ZERO_LSN(ckp_lsn))
- ckp_lsn = tmp_lsn;
- ret = 0;
- } else if (ret != 0)
- goto msgerr;
+ if (ret != 0)
+ if (ret != DB_TXN_CKP)
+ goto msgerr;
+ else
+ ret = 0;
}
if (ret != 0 && ret != DB_NOTFOUND)
goto out;
+ /*
+ * Pass #3.
+ */
for (ret = log_get(lp, &lsn, &data, DB_NEXT);
ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT)) {
ret = __db_dispatch(lp, &data, &lsn, TXN_FORWARD_ROLL, txninfo);
- if (ret == DB_TXN_CKP)
- ret = 0;
- else if (ret != 0)
- goto msgerr;
+ if (ret != 0)
+ if (ret != DB_TXN_CKP)
+ goto msgerr;
+ else
+ ret = 0;
}
if (ret != DB_NOTFOUND)
goto out;
goto out;
if (dbenv->db_verbose) {
- __db_err(lp->dbenv, "Recovery complete at %s", ctime(&now));
+ __db_err(lp->dbenv, "Recovery complete at %.24s", ctime(&now));
__db_err(lp->dbenv, "%s %lu %s [%lu][%lu]",
"Maximum transaction id",
(u_long)dbenv->tx_info->region->last_txnid,
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_err.c 10.19 (Sleepycat) 11/9/97";
+static const char sccsid[] = "@(#)db_err.c 10.21 (Sleepycat) 1/13/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
DB_TXN *b;
DBC **c;
{
- a = a; b = b; c = c; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, NULL);
+ COMPQUIET(c, NULL);
return (EPERM);
}
DBT *c;
int d;
{
- a = a; b = b; c = c; d = d; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, NULL);
+ COMPQUIET(c, NULL);
+ COMPQUIET(d, 0);
return (EPERM);
}
DB *a;
int *b;
{
- a = a; b = b; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, NULL);
return (EPERM);
}
DBT *c, *d;
int e;
{
- a = a; b = b; c = c; d = d; e = e; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, NULL);
+ COMPQUIET(c, NULL);
+ COMPQUIET(d, NULL);
+ COMPQUIET(e, 0);
return (EPERM);
}
void *(*c) __P((size_t));
int d;
{
- a = a; b = b; c = c; d = d; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, NULL);
+ COMPQUIET(c, NULL);
+ COMPQUIET(d, 0);
return (EPERM);
}
DB *a;
int b;
{
- a = a; b = b; /* XXX: Shut the compiler up. */
+ COMPQUIET(a, NULL);
+ COMPQUIET(b, 0);
return (EPERM);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_region.c 10.18 (Sleepycat) 11/28/97";
+static const char sccsid[] = "@(#)db_region.c 10.21 (Sleepycat) 1/16/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
{
int ret;
+ COMPQUIET(dbenv, NULL);
+
/*
* Initialize the common information.
*
* been initialized in which case an attempt to get it could lead to
* random behavior. If the version number isn't there (the file size
* is too small) or it's 0, we know that the region is being created.
+ *
+ * We also make sure to check the return of __db_mutex_lock() here,
+ * even though we don't usually check elsewhere. This is the first
+ * lock we attempt to acquire, and if it fails we have to know. (It
+ * can fail -- SunOS, using fcntl(2) for locking, with an in-memory
+ * filesystem specified as the database home.)
*/
__db_mutex_init(&rp->lock, MUTEX_LOCK_OFFSET(rp, &rp->lock));
if (lock_region && (ret = __db_mutex_lock(&rp->lock, fd)) != 0)
void *retp;
{
RLAYOUT *rp;
- off_t size1, size2;
+ size_t size;
+ u_int32_t mbytes, bytes;
int fd, ret;
char *name;
* flatly impossible. Hope that mmap fails if the file is too large.
*
*/
- if ((ret = __db_ioinfo(name, fd, &size1, NULL)) != 0) {
+ if ((ret = __db_ioinfo(name, fd, &mbytes, &bytes, NULL)) != 0) {
__db_err(dbenv, "%s: %s", name, strerror(ret));
goto err2;
}
+ size = mbytes * MEGABYTE + bytes;
/* Check to make sure the first block has been written. */
- if ((size_t)size1 < sizeof(RLAYOUT)) {
+ if (size < sizeof(RLAYOUT)) {
ret = EAGAIN;
goto err2;
}
/* Map in whatever is there. */
- if ((ret = __db_rmap(dbenv, fd, size1, &rp)) != 0)
+ if ((ret = __db_rmap(dbenv, fd, size, &rp)) != 0)
goto err2;
/*
* getting the size of the file and checking the major version. Check
* to make sure we got the entire file.
*/
- if ((ret = __db_ioinfo(name, fd, &size2, NULL)) != 0) {
+ if ((ret = __db_ioinfo(name, fd, &mbytes, &bytes, NULL)) != 0) {
__db_err(dbenv, "%s: %s", name, strerror(ret));
goto err1;
}
- if (size1 != size2) {
+ if (size != mbytes * MEGABYTE + bytes) {
ret = EAGAIN;
goto err1;
}
int fd;
size_t incr;
{
-#ifdef MMAP_INIT_NEEDED
size_t i;
-#endif
ssize_t nw;
- int ret;
+ int mmap_init_needed, ret;
char buf[__DB_VMPAGESIZE];
/* Seek to the end of the region. */
/*
* Historically, some systems required that all of the bytes of the
- * region be written before you could mmap it and access it randomly.
+ * region be written before it could be mmapped and accessed randomly.
+ *
+ * Windows/95 doesn't have that problem, but it leaves file contents
+ * uninitialized. Win/NT apparently initializes them.
*/
#ifdef MMAP_INIT_NEEDED
- /* Extend the region by writing each new page. */
- for (i = 0; i < incr; i += __DB_VMPAGESIZE) {
+ mmap_init_needed = 1;
+#else
+ mmap_init_needed = __os_oldwin();
+#endif
+ if (mmap_init_needed)
+ /* Extend the region by writing each new page. */
+ for (i = 0; i < incr; i += __DB_VMPAGESIZE) {
+ if ((ret = __db_write(fd, buf, sizeof(buf), &nw)) != 0)
+ goto err;
+ if (nw != sizeof(buf))
+ goto eio;
+ }
+ else {
+ /*
+ * Extend the region by writing the last page.
+ *
+ * Round off the increment to the next page boundary.
+ */
+ incr += __DB_VMPAGESIZE - 1;
+ incr -= incr % __DB_VMPAGESIZE;
+
+ /* Write the last page, not the page after the last. */
+ if ((ret =
+ __db_seek(fd, 0, 0, incr - __DB_VMPAGESIZE, SEEK_CUR)) != 0)
+ goto err;
if ((ret = __db_write(fd, buf, sizeof(buf), &nw)) != 0)
goto err;
if (nw != sizeof(buf))
goto eio;
}
-#else
- /*
- * Extend the region by writing the last page.
- *
- * Round off the increment to the next page boundary.
- */
- incr += __DB_VMPAGESIZE - 1;
- incr -= incr % __DB_VMPAGESIZE;
-
- /* Write the last page, not the page after the last. */
- if ((ret = __db_seek(fd, 0, 0, incr - __DB_VMPAGESIZE, SEEK_CUR)) != 0)
- goto err;
- if ((ret = __db_write(fd, buf, sizeof(buf), &nw)) != 0)
- goto err;
- if (nw != sizeof(buf))
- goto eio;
-#endif
return (0);
eio: ret = EIO;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_shash.c 10.3 (Sleepycat) 6/21/97";
+static const char sccsid[] = "@(#)db_shash.c 10.4 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
/* Powers-of-2 and close-by prime number pairs. */
static const struct {
- int power;
- int prime;
+ u_int power;
+ u_int prime;
} list[] = {
{ 64, 67},
{ 128, 131},
* __db_tablesize --
* Choose a size for the hash table.
*
- * PUBLIC: int __db_tablesize __P((int));
+ * PUBLIC: int __db_tablesize __P((u_int));
*/
int
__db_tablesize(n_buckets)
- int n_buckets;
+ u_int n_buckets;
{
int i;
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db.h.src 10.97 (Sleepycat) 11/28/97
+ * @(#)db.h.src 10.102 (Sleepycat) 1/18/98
*/
#ifndef _DB_H_
#define DB_VERSION_MAJOR 2
#define DB_VERSION_MINOR 3
-#define DB_VERSION_PATCH 14
-#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.14: (11/28/97)"
+#define DB_VERSION_PATCH 16
+#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.16: (1/19/98)"
typedef u_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset type. */
DB_LOCKTAB *lk_info; /* Return from lock_open(). */
u_int8_t *lk_conflicts; /* Two dimensional conflict matrix. */
int lk_modes; /* Number of lock modes in table. */
- unsigned int lk_max; /* Maximum number of locks. */
+ u_int lk_max; /* Maximum number of locks. */
u_int32_t lk_detect; /* Deadlock detect on every conflict. */
/* Logging. */
#define DB_RE_PAD 0x004000 /* DB_PAD (internal). */
#define DB_RE_RENUMBER 0x008000 /* DB_RENUMBER (internal). */
#define DB_RE_SNAPSHOT 0x010000 /* DB_SNAPSHOT (internal). */
-
u_int32_t flags;
};
int db_value_set __P((int, int));
char *db_version __P((int *, int *, int *));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int lock_vec __P((DB_LOCKTAB *,
u_int32_t, int, DB_LOCKREQ *, int, DB_LOCKREQ **));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
u_int32_t st_scount; /* Total writes to the log. */
u_int32_t st_region_wait; /* Region lock granted after wait. */
u_int32_t st_region_nowait; /* Region lock granted without wait. */
+ u_int32_t st_cur_file; /* Current log file number. */
+ u_int32_t st_cur_offset; /* Current log file offset. */
};
#if defined(__cplusplus)
int log_unlink __P((const char *, int, DB_ENV *));
int log_unregister __P((DB_LOG *, u_int32_t));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int memp_trickle __P((DB_MPOOL *, int, int *));
int memp_unlink __P((const char *, int, DB_ENV *));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t)));
int txn_unlink __P((const char *, int, DB_ENV *));
#if defined(__cplusplus)
-};
+}
#endif
-#ifdef DB_DBM_HSEARCH
+#ifndef DB_DBM_HSEARCH
+#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */
+#endif
+#if DB_DBM_HSEARCH != 0
/*******************************************************
* Dbm/Ndbm historic interfaces.
*******************************************************/
int dsize;
} datum;
+/*
+ * Translate DBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ *
+ * The global variables dbrdonly, dirf and pagf were not retained when
+ * 4BSD replaced the dbm interface with ndbm, and are not support here.
+ */
+#define dbminit(a) __db_dbm_init(a)
+#if !defined(__cplusplus)
+#define delete(a) __db_dbm_delete(a)
+#endif
+#define fetch(a) __db_dbm_fetch(a)
+#define firstkey __db_dbm_firstkey
+#define nextkey(a) __db_dbm_nextkey(a)
+#define store(a, b) __db_dbm_store(a, b)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
-int dbminit __P((char *));
-#if !defined(__cplusplus)
-int delete __P((datum));
+int __db_dbm_init __P((char *));
+int __db_dbm_delete __P((datum));
+int __db_dbm_dbrdonly __P((void));
+int __db_dbm_dirf __P((void));
+datum __db_dbm_fetch __P((datum));
+datum __db_dbm_firstkey __P((void));
+datum __db_dbm_nextkey __P((datum));
+int __db_dbm_pagf __P((void));
+int __db_dbm_store __P((datum, datum));
+#if defined(__cplusplus)
+}
#endif
-datum fetch __P((datum));
-datum firstkey __P((void));
-datum nextkey __P((datum));
-int store __P((datum, datum));
/*
- * !!!
- * Don't prototype:
- *
- * dbm_clearerr(DBM *db);
- * dbm_dirfno(DBM *db);
- * dbm_error(DBM *db);
- * dbm_pagfno(DBM *db);
- * dbm_rdonly(DBM *db);
- *
- * they weren't documented and were historically implemented as #define's.
+ * Translate NDBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
*/
-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));
+#define dbm_clearerr(a) __db_ndbm_clearerr(a)
+#define dbm_close(a) __db_ndbm_close(a)
+#define dbm_delete(a, b) __db_ndbm_delete(a, b)
+#define dbm_dirfno(a) __db_ndbm_dirfno(a)
+#define dbm_error(a) __db_ndbm_error(a)
+#define dbm_fetch(a, b) __db_ndbm_fetch(a, b)
+#define dbm_firstkey(a) __db_ndbm_firstkey(a)
+#define dbm_nextkey(a) __db_ndbm_nextkey(a)
+#define dbm_open(a, b, c) __db_ndbm_open(a, b, c)
+#define dbm_pagfno(a) __db_ndbm_pagfno(a)
+#define dbm_rdonly(a) __db_ndbm_rdonly(a)
+#define dbm_store(a, b, c, d) __db_ndbm_store(a, b, c, d)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
-};
+extern "C" {
+#endif
+int __db_ndbm_clearerr __P((DBM *));
+void __db_ndbm_close __P((DBM *));
+int __db_ndbm_delete __P((DBM *, datum));
+int __db_ndbm_dirfno __P((DBM *));
+int __db_ndbm_error __P((DBM *));
+datum __db_ndbm_fetch __P((DBM *, datum));
+datum __db_ndbm_firstkey __P((DBM *));
+datum __db_ndbm_nextkey __P((DBM *));
+DBM *__db_ndbm_open __P((const char *, int, int));
+int __db_ndbm_pagfno __P((DBM *));
+int __db_ndbm_rdonly __P((DBM *));
+int __db_ndbm_store __P((DBM *, datum, datum, int));
+#if defined(__cplusplus)
+}
#endif
/*******************************************************
void *data;
} ENTRY;
+/*
+ * Translate HSEARCH calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ */
+#define hcreate(a) __db_hcreate(a)
+#define hdestroy __db_hdestroy
+#define hsearch(a, b) __db_hsearch(a, b)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
-int hcreate __P((unsigned int));
-void hdestroy __P((void));
-ENTRY *hsearch __P((ENTRY, ACTION));
+int __db_hcreate __P((unsigned int));
+void __db_hdestroy __P((void));
+ENTRY *__db_hsearch __P((ENTRY, ACTION));
#if defined(__cplusplus)
-};
+}
#endif
#endif /* DB_DBM_HSEARCH */
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db.c 10.44 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)db.c 10.45 (Sleepycat) 12/4/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
DB_ENV *envp, t_dbenv;
DB_PGINFO pginfo;
HASHHDR *hashm;
- off_t io;
size_t cachesize;
ssize_t nr;
+ u_int32_t iopsize;
int fd, ftype, need_fileid, restore, ret, retry_cnt, swapped;
char *real_name, mbuf[512];
* sizes, we limit the default pagesize to 16K.
*/
if (dbp->pgsize == 0) {
- if ((ret =
- __db_ioinfo(real_name, fd, NULL, &io)) != 0) {
+ if ((ret = __db_ioinfo(real_name,
+ fd, NULL, NULL, &iopsize)) != 0) {
__db_err(dbenv,
"%s: %s", real_name, strerror(ret));
goto err;
}
- if (io < 512)
- io = 512;
- if (io > 16 * 1024)
- io = 16 * 1024;
- dbp->pgsize = io;
+ if (iopsize < 512)
+ iopsize = 512;
+ if (iopsize > 16 * 1024)
+ iopsize = 16 * 1024;
+ dbp->pgsize = iopsize;
F_SET(dbp, DB_AM_PGDEF);
}
* PUBLIC: int __db_addrem_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
- * PUBLIC: size_t, DBT *, DBT *, DB_LSN *));
+ * PUBLIC: size_t, const DBT *, const DBT *, DB_LSN *));
*/
int __db_addrem_log(logp, txnid, ret_lsnp, flags,
opcode, fileid, pgno, indx, nbytes, hdr,
db_pgno_t pgno;
u_int32_t indx;
size_t nbytes;
- DBT *hdr;
- DBT *dbt;
+ const DBT *hdr;
+ const DBT *dbt;
DB_LSN * pagelsn;
{
DBT logrec;
/*
* PUBLIC: int __db_split_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, DBT *,
+ * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, const DBT *,
* PUBLIC: DB_LSN *));
*/
int __db_split_log(logp, txnid, ret_lsnp, flags,
u_int32_t opcode;
u_int32_t fileid;
db_pgno_t pgno;
- DBT *pageimage;
+ const DBT *pageimage;
DB_LSN * pagelsn;
{
DBT logrec;
* PUBLIC: int __db_big_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, u_int32_t, db_pgno_t, db_pgno_t,
- * PUBLIC: db_pgno_t, DBT *, DB_LSN *, DB_LSN *,
+ * PUBLIC: db_pgno_t, const DBT *, DB_LSN *, DB_LSN *,
* PUBLIC: DB_LSN *));
*/
int __db_big_log(logp, txnid, ret_lsnp, flags,
db_pgno_t pgno;
db_pgno_t prev_pgno;
db_pgno_t next_pgno;
- DBT *dbt;
+ const DBT *dbt;
DB_LSN * pagelsn;
DB_LSN * prevlsn;
DB_LSN * nextlsn;
/*
* PUBLIC: int __db_debug_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: DBT *, u_int32_t, DBT *, DBT *,
+ * PUBLIC: const DBT *, u_int32_t, const DBT *, const DBT *,
* PUBLIC: u_int32_t));
*/
int __db_debug_log(logp, txnid, ret_lsnp, flags,
DB_TXN *txnid;
DB_LSN *ret_lsnp;
u_int32_t flags;
- DBT *op;
+ const DBT *op;
u_int32_t fileid;
- DBT *key;
- DBT *data;
+ const DBT *key;
+ const DBT *data;
u_int32_t arg_flags;
{
DBT logrec;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_conv.c 10.7 (Sleepycat) 9/21/97";
+static const char sccsid[] = "@(#)db_conv.c 10.8 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
*/
static int
__db_convert(pg, pp, pagesize, pgin)
- db_pgno_t pg; /* Unused, but left for the future. */
+ db_pgno_t pg;
void *pp;
size_t pagesize;
int pgin;
db_indx_t i, len, tmp;
u_int8_t *p, *end;
+ COMPQUIET(pg, 0);
+
h = pp;
if (pgin) {
M_32_SWAP(h->lsn.file);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_dispatch.c 10.7 (Sleepycat) 11/23/97";
+static const char sccsid[] = "@(#)db_dispatch.c 10.9 (Sleepycat) 1/17/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include "db_dispatch.h"
#include "db_am.h"
#include "common_ext.h"
+#include "log_auto.h"
/*
* Data structures to manage the DB dispatch table. The dispatch table
* seen it, then we call the appropriate recovery routine
* in "abort mode".
*/
- if (__db_txnlist_find(info, txnid) == DB_NOTFOUND)
+ if (rectype == DB_log_register ||
+ __db_txnlist_find(info, txnid) == DB_NOTFOUND)
return ((dispatch_table[rectype])(logp,
db, lsnp, TXN_UNDO, info));
break;
* In the forward pass, if we haven't seen the transaction,
* do nothing, else recovery it.
*/
- if (__db_txnlist_find(info, txnid) != DB_NOTFOUND)
+ if (rectype == DB_log_register ||
+ __db_txnlist_find(info, txnid) != DB_NOTFOUND)
return ((dispatch_table[rectype])(logp,
db, lsnp, TXN_REDO, info));
break;
/*
* __db_txnlist_print --
* Print out the transaction list.
+ *
+ * PUBLIC: void __db_txnlist_print __P((void *));
*/
void
__db_txnlist_print(listp)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_dup.c 10.10 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)db_dup.c 10.11 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* __db_ditem --
* Remove an item from a page.
*
- * PUBLIC: int __db_ditem __P((DB *, PAGE *, int, u_int32_t));
+ * PUBLIC: int __db_ditem __P((DB *, PAGE *, u_int32_t, u_int32_t));
*/
int
__db_ditem(dbp, pagep, indx, nbytes)
DB *dbp;
PAGE *pagep;
- int indx;
- u_int32_t nbytes;
+ u_int32_t indx, nbytes;
{
DBT ldbt;
db_indx_t cnt, offset;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_pr.c 10.19 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)db_pr.c 10.20 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
{
FILE *fp, *save_fp;
- save_fp = NULL; /* XXX: Shut the compiler up. */
+ COMPQUIET(save_fp, NULL);
if (set_psize == PSIZE_BOUNDARY)
__db_psize(dbp->mpf);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_rec.c 10.10 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)db_rec.c 10.12 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
} else if ((cmp_n == 0 && !redo && argp->opcode == DB_ADD_DUP) ||
(cmp_p == 0 && redo && argp->opcode == DB_REM_DUP)) {
/* Need to undo an add, or redo a delete. */
- if ((ret = __db_ditem(file_dbp, pagep, argp->indx,
- argp->nbytes)) != 0)
+ if ((ret = __db_ditem(file_dbp,
+ pagep, argp->indx, argp->nbytes)) != 0)
goto out;
change = DB_MPOOL_DIRTY;
}
__db_debug_args *argp;
int ret;
+ COMPQUIET(redo, 0);
+ COMPQUIET(logp, NULL);
+
REC_PRINT(__db_debug_print);
REC_NOOP_INTRO(__db_debug_read);
__db_noop_args *argp;
int ret;
+ COMPQUIET(redo, 0);
+ COMPQUIET(logp, NULL);
+
REC_PRINT(__db_noop_print);
REC_NOOP_INTRO(__db_noop_read);
*/
if (file != NULL) {
if (oflags & O_CREAT && __db_exists(file, NULL) != 0)
- (void)__os_close(open(file, oflags, mode));
+ (void)__os_close(__os_open(file, oflags, mode));
dbinfop->re_source = (char *)file;
file = NULL;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)db_185.h.src 8.4 (Sleepycat) 9/16/97
+ * @(#)db_185.h.src 8.5 (Sleepycat) 1/15/98
*/
#ifndef _DB_185_H_
* XXX
* SGI/IRIX already has a pgno_t.
*/
-#ifdef sgi
-#define pgno_t db_pgno_t
+#ifdef sgi
+#define pgno_t db_pgno_t
#endif
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
#if defined(__cplusplus)
-};
+}
#endif
#endif /* !_DB_185_H_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_int.h.src 10.37 (Sleepycat) 11/25/97
+ * @(#)db_int.h.src 10.41 (Sleepycat) 1/8/98
*/
#ifndef _DB_INTERNAL_H_
/*******************************************************
* General purpose constants and macros.
*******************************************************/
-#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */
#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */
+#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */
#define DB_MIN_PGSIZE 0x000200 /* Minimum page size. */
#define DB_MAX_PGSIZE 0x010000 /* Maximum page size. */
#define DB_MINCACHE 10 /* Minimum cached pages */
+#define MEGABYTE 1048576
+
+/*
+ * If we are unable to determine the underlying filesystem block size, use
+ * 8K on the grounds that most OS's use less than 8K as their VM page size.
+ */
+#define DB_DEF_IOSIZE (8 * 1024)
+
/*
* Aligning items to particular sizes or in pages or memory. ALIGNP is a
* separate macro, as we've had to cast the pointer to different integral
#undef DB_LINE
#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
+/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */
+#define COMPQUIET(n, v) (n) = (v)
+
/*******************************************************
* Files.
*******************************************************/
/*
* The offset of a mutex in memory.
+ *
+ * !!!
+ * Not an off_t, so backing file offsets MUST be less than 4Gb. See the
+ * off field of the db_mutex_t as well.
*/
-#define MUTEX_LOCK_OFFSET(a, b) ((off_t)((u_int8_t *)b - (u_int8_t *)a))
+#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_int8_t *)b - (u_int8_t *)a))
typedef struct _db_mutex_t {
#ifdef HAVE_SPINLOCKS
- tsl_t tsl_resource; /* Resource test and set. */
+ tsl_t tsl_resource; /* Resource test and set. */
#ifdef DEBUG
- u_long pid; /* Lock holder: 0 or process pid. */
+ u_long pid; /* Lock holder: 0 or process pid. */
#endif
#else
- off_t off; /* Backing file offset. */
- u_long pid; /* Lock holder: 0 or process pid. */
+ u_int32_t off; /* Backing file offset. */
+ u_long pid; /* Lock holder: 0 or process pid. */
#endif
u_int32_t spins; /* Spins before block. */
u_int32_t mutex_set_wait; /* Granted after wait. */
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)dbm.c 10.7 (Sleepycat) 11/25/97";
+static const char sccsid[] = "@(#)dbm.c 10.10 (Sleepycat) 1/16/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <string.h>
#endif
-#define DB_DBM_HSEARCH
+#define DB_DBM_HSEARCH 1
#include "db_int.h"
#include "db_page.h"
#include "hash.h"
-/* Provide prototypes here since there are none in db.h. */
-int dbm_clearerr __P((DBM *));
-int dbm_dirfno __P((DBM *));
-int dbm_error __P((DBM *));
-int dbm_pagfno __P((DBM *));
-
/*
*
* This package provides dbm and ndbm compatible interfaces to DB.
static void __db_no_open __P((void));
int
-dbminit(file)
+__db_dbm_init(file)
char *file;
{
if (__cur_db != NULL)
return (0);
return (-1);
}
+weak_alias (__db_dbm_init, dbminit)
datum
-fetch(key)
+__db_dbm_fetch(key)
datum key;
{
datum item;
}
return (dbm_fetch(__cur_db, key));
}
+weak_alias (__db_dbm_fetch, fetch)
datum
-firstkey()
+__db_dbm_firstkey()
{
datum item;
}
return (dbm_firstkey(__cur_db));
}
+#undef firstkey
+weak_alias (__db_dbm_firstkey, firstkey)
datum
-nextkey(key)
+__db_dbm_nextkey(key)
datum key;
{
datum item;
+ COMPQUIET(key.dsize, 0);
+
if (__cur_db == NULL) {
__db_no_open();
item.dptr = 0;
}
return (dbm_nextkey(__cur_db));
}
+weak_alias (__db_dbm_nextkey, nextkey)
int
-delete(key)
+__db_dbm_delete(key)
datum key;
{
int ret;
ret = (((DB *)__cur_db)->sync)((DB *)__cur_db, 0);
return (ret);
}
+weak_alias (__db_dbm_delete, delete)
int
-store(key, dat)
+__db_dbm_store(key, dat)
datum key, dat;
{
int ret;
ret = (((DB *)__cur_db)->sync)((DB *)__cur_db, 0);
return (ret);
}
+weak_alias (__db_dbm_store, store)
static void
__db_no_open()
* NULL on failure
*/
DBM *
-dbm_open(file, oflags, mode)
+__db_ndbm_open(file, oflags, mode)
const char *file;
int oflags, mode;
{
return (NULL);
return ((DBM *)dbp);
}
+weak_alias (__db_ndbm_open, dbm_open)
/*
* Returns:
* Nothing.
*/
void
-dbm_close(db)
+__db_ndbm_close(db)
DBM *db;
{
(void)db->close(db, 0);
}
+weak_alias (__db_ndbm_close, dbm_close)
/*
* Returns:
* NULL on failure
*/
datum
-dbm_fetch(db, key)
+__db_ndbm_fetch(db, key)
DBM *db;
datum key;
{
}
return (data);
}
+weak_alias (__db_ndbm_fetch, dbm_fetch)
/*
* Returns:
* NULL on failure
*/
datum
-dbm_firstkey(db)
+__db_ndbm_firstkey(db)
DBM *db;
{
DBT _key, _data;
}
return (key);
}
+weak_alias (__db_ndbm_firstkey, dbm_firstkey)
/*
* Returns:
* NULL on failure
*/
datum
-dbm_nextkey(db)
+__db_ndbm_nextkey(db)
DBM *db;
{
DBC *cp;
}
return (key);
}
+weak_alias (__db_ndbm_nextkey, dbm_nextkey)
/*
* Returns:
* <0 failure
*/
int
-dbm_delete(db, key)
+__db_ndbm_delete(db, key)
DBM *db;
datum key;
{
}
return (ret);
}
+weak_alias (__db_ndbm_delete, dbm_delete)
/*
* Returns:
* 1 if DBM_INSERT and entry exists
*/
int
-dbm_store(db, key, data, flags)
+__db_ndbm_store(db, key, data, flags)
DBM *db;
datum key, data;
int flags;
return (db->put((DB *)db,
NULL, &_key, &_data, (flags == DBM_INSERT) ? DB_NOOVERWRITE : 0));
}
+weak_alias (__db_ndbm_store, dbm_store)
int
-dbm_error(db)
+__db_ndbm_error(db)
DBM *db;
{
HTAB *hp;
hp = (HTAB *)db->internal;
return (hp->local_errno);
}
+weak_alias (__db_ndbm_error, dbm_error)
int
-dbm_clearerr(db)
+__db_ndbm_clearerr(db)
DBM *db;
{
HTAB *hp;
hp->local_errno = 0;
return (0);
}
+weak_alias (__db_ndbm_clearerr, dbm_clearerr)
+
+/*
+ * Returns:
+ * 1 if read-only
+ * 0 if not read-only
+ */
+int
+__db_ndbm_rdonly(db)
+ DBM *db;
+{
+ return (F_ISSET((DB *)db, DB_AM_RDONLY) ? 1 : 0);
+}
/*
* XXX
* and picked one to use at random.
*/
int
-dbm_dirfno(db)
+__db_ndbm_dirfno(db)
DBM *db;
{
int fd;
(void)db->fd(db, &fd);
return (fd);
}
+weak_alias (__db_ndbm_dirfno, dbm_dirfno)
int
-dbm_pagfno(db)
+__db_ndbm_pagfno(db)
DBM *db;
{
int fd;
(void)db->fd(db, &fd);
return (fd);
}
+weak_alias (__db_ndbm_pagfno, dbm_pagfno)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)hash.c 10.33 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)hash.c 10.36 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
} else /* Case 1 */
F_SET(hcp, H_DELETED);
if (chg_pgno != PGNO_INVALID)
- __ham_c_update(hashp, hcp, chg_pgno, 0, 0, 1);
+ __ham_c_update(hcp, chg_pgno, 0, 0, 1);
} else if (F_ISSET(hcp, H_ISDUP)) { /* on page */
if (hcp->dup_off == 0 && DUP_SIZE(hcp->dup_len) ==
LEN_HDATA(hcp->pagep, hashp->hdr->pagesize, hcp->bndx))
ret = __ham_replpair(hashp, hcp, &repldbt, 0);
hcp->dup_tlen -= DUP_SIZE(hcp->dup_len);
F_SET(hcp, H_DELETED);
- __ham_c_update(hashp, hcp, hcp->pgno,
+ __ham_c_update(hcp, hcp->pgno,
DUP_SIZE(hcp->dup_len), 0, 1);
}
* if the next doubling is going to be big (more than 8
* pages), we have some extra pages around.
*/
- if (hashp->hdr->max_bucket + 1 >= 8 &&
+ if (hashp->hdr->max_bucket + 1 >= 8 &&
hashp->hdr->spares[hashp->hdr->ovfl_point] <
- hashp->hdr->spares[hashp->hdr->ovfl_point - 1] +
+ hashp->hdr->spares[hashp->hdr->ovfl_point - 1] +
hashp->hdr->ovfl_point + 1)
__ham_init_ovflpages(hashp);
}
* added (add == 1) or deleted (add == 0).
* dup indicates if the addition occurred into a duplicate set.
*
- * PUBLIC: void __ham_c_update __P((HTAB *,
- * PUBLIC: HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
+ * PUBLIC: void __ham_c_update
+ * PUBLIC: __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
*/
void
-__ham_c_update(hashp, hcp, chg_pgno, len, add, dup)
- HTAB *hashp;
+__ham_c_update(hcp, chg_pgno, len, add, is_dup)
HASH_CURSOR *hcp;
db_pgno_t chg_pgno;
u_int32_t len;
- int add;
- int dup;
+ int add, is_dup;
{
DBC *cp;
HTAB *hp;
int page_deleted;
/*
- * Regular adds are always at the end of a given page,
- * so we never have to adjust anyone's cursor after
- * a regular add.
+ * Regular adds are always at the end of a given page, so we never
+ * have to adjust anyone's cursor after a regular add.
*/
- if (!dup && add)
+ if (!is_dup && add)
return;
/*
* Determine if a page was deleted. If this is a regular update
- * (i.e., not dup) then the deleted page's number will be that in
+ * (i.e., not is_dup) then the deleted page's number will be that in
* chg_pgno, and the pgno in the cursor will be different. If this
* was an onpage-duplicate, then the same conditions apply. If this
* was an off-page duplicate, then we need to verify if hcp->dpgno
* is the same (no delete) or different (delete) than chg_pgno.
*/
- if (!dup || hcp->dpgno == PGNO_INVALID)
+ if (!is_dup || hcp->dpgno == PGNO_INVALID)
page_deleted =
chg_pgno != PGNO_INVALID && chg_pgno != hcp->pgno;
else
lcp = (HASH_CURSOR *)cp->internal;
- if (!dup && lcp->pgno != chg_pgno)
- continue;
-
- if (dup && F_ISSET(hcp, H_DELETED) && lcp->pgno != chg_pgno)
+ if (!is_dup && lcp->pgno != chg_pgno)
continue;
- if (dup && !F_ISSET(hcp, H_DELETED) && lcp->dpgno != chg_pgno)
- continue;
+ if (is_dup) {
+ if (F_ISSET(hcp, H_DELETED) && lcp->pgno != chg_pgno)
+ continue;
+ if (!F_ISSET(hcp, H_DELETED) && lcp->dpgno != chg_pgno)
+ continue;
+ }
if (page_deleted) {
- if (dup) {
+ if (is_dup) {
lcp->dpgno = hcp->dpgno;
lcp->dndx = hcp->dndx;
} else {
continue;
}
- if (!dup && lcp->bndx > hcp->bndx)
+ if (!is_dup && lcp->bndx > hcp->bndx)
lcp->bndx--;
- else if (!dup && lcp->bndx == hcp->bndx)
+ else if (!is_dup && lcp->bndx == hcp->bndx)
F_SET(lcp, H_DELETED);
- else if (dup && lcp->bndx == hcp->bndx) {
+ else if (is_dup && lcp->bndx == hcp->bndx) {
/* Assign dpgno in case there was page conversion. */
lcp->dpgno = hcp->dpgno;
if (add && lcp->dndx >= hcp->dndx )
* PUBLIC: int __ham_insdel_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
- * PUBLIC: DB_LSN *, DBT *, DBT *));
+ * PUBLIC: DB_LSN *, const DBT *, const DBT *));
*/
int __ham_insdel_log(logp, txnid, ret_lsnp, flags,
opcode, fileid, pgno, ndx, pagelsn, key,
db_pgno_t pgno;
u_int32_t ndx;
DB_LSN * pagelsn;
- DBT *key;
- DBT *data;
+ const DBT *key;
+ const DBT *data;
{
DBT logrec;
DB_LSN *lsnp, null_lsn;
/*
* PUBLIC: int __ham_splitdata_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, DBT *,
+ * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, const DBT *,
* PUBLIC: DB_LSN *));
*/
int __ham_splitdata_log(logp, txnid, ret_lsnp, flags,
u_int32_t fileid;
u_int32_t opcode;
db_pgno_t pgno;
- DBT *pageimage;
+ const DBT *pageimage;
DB_LSN * pagelsn;
{
DBT logrec;
* PUBLIC: int __ham_replace_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, db_pgno_t, u_int32_t, DB_LSN *,
- * PUBLIC: int32_t, DBT *, DBT *, u_int32_t));
+ * PUBLIC: int32_t, const DBT *, const DBT *, u_int32_t));
*/
int __ham_replace_log(logp, txnid, ret_lsnp, flags,
fileid, pgno, ndx, pagelsn, off, olditem,
u_int32_t ndx;
DB_LSN * pagelsn;
int32_t off;
- DBT *olditem;
- DBT *newitem;
+ const DBT *olditem;
+ const DBT *newitem;
u_int32_t makedup;
{
DBT logrec;
* PUBLIC: int __ham_copypage_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
- * PUBLIC: DB_LSN *, db_pgno_t, DB_LSN *, DBT *));
+ * PUBLIC: DB_LSN *, db_pgno_t, DB_LSN *, const DBT *));
*/
int __ham_copypage_log(logp, txnid, ret_lsnp, flags,
fileid, pgno, pagelsn, next_pgno, nextlsn, nnext_pgno,
DB_LSN * nextlsn;
db_pgno_t nnext_pgno;
DB_LSN * nnextlsn;
- DBT *page;
+ const DBT *page;
{
DBT logrec;
DB_LSN *lsnp, null_lsn;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)hash_dup.c 10.8 (Sleepycat) 10/14/97";
+static const char sccsid[] = "@(#)hash_dup.c 10.10 (Sleepycat) 1/8/98";
#endif /* not lint */
/*
ret = __ham_replpair(hashp, hcp, &tmp_val, 0);
if (ret == 0)
ret = __ham_dirty_page(hashp, hcp->pagep);
- __ham_c_update(hashp, hcp, hcp->pgno, tmp_val.size, 1, 1);
+ __ham_c_update(hcp, hcp->pgno, tmp_val.size, 1, 1);
return (ret);
}
ret = __db_dput(hashp->dbp,
nval, &hcp->dpagep, &hcp->dndx, __ham_overflow_page);
hcp->pgno = PGNO(hcp->pagep);
- __ham_c_update(hashp, hcp, hcp->pgno, nval->size, 1, 1);
+ __ham_c_update(hcp, hcp->pgno, nval->size, 1, 1);
return (ret);
}
}
static int
-__ham_make_dup(notdup, dup, bufp, sizep)
+__ham_make_dup(notdup, duplicate, bufp, sizep)
const DBT *notdup;
- DBT *dup;
+ DBT *duplicate;
void **bufp;
u_int32_t *sizep;
{
item_size = (db_indx_t)notdup->size;
tsize = DUP_SIZE(item_size);
- if ((ret = __ham_init_dbt(dup, tsize, bufp, sizep)) != 0)
+ if ((ret = __ham_init_dbt(duplicate, tsize, bufp, sizep)) != 0)
return (ret);
- dup->dlen = 0;
- dup->flags = notdup->flags;
- F_SET(dup, DB_DBT_PARTIAL);
+ duplicate->dlen = 0;
+ duplicate->flags = notdup->flags;
+ F_SET(duplicate, DB_DBT_PARTIAL);
- p = dup->data;
+ p = duplicate->data;
memcpy(p, &item_size, sizeof(db_indx_t));
p += sizeof(db_indx_t);
memcpy(p, notdup->data, notdup->size);
p += notdup->size;
memcpy(p, &item_size, sizeof(db_indx_t));
- dup->doff = 0;
- dup->dlen = notdup->size;
+ duplicate->doff = 0;
+ duplicate->dlen = notdup->size;
return (0);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)hash_page.c 10.29 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)hash_page.c 10.31 (Sleepycat) 1/8/98";
#endif /* not lint */
/*
chg_pgno = cursorp->pgno;
ret = __ham_dirty_page(hashp, p);
}
- __ham_c_update(hashp, cursorp, chg_pgno, 0, 0, 0);
+ __ham_c_update(cursorp, chg_pgno, 0, 0, 0);
/*
* Since we just deleted a pair from the master page, anything
const DBT *key, *val;
int type;
{
- DBT *pkey, *pdata, key_dbt, data_dbt;
+ const DBT *pkey, *pdata;
+ DBT key_dbt, data_dbt;
DB_LSN new_lsn;
HOFFPAGE doff, koff;
db_pgno_t next_pgno;
pkey = &key_dbt;
key_type = H_OFFPAGE;
} else {
- pkey = (DBT *)key;
+ pkey = key;
key_type = H_KEYDATA;
}
pdata = &data_dbt;
data_type = H_OFFPAGE;
} else {
- pdata = (DBT *)val;
+ pdata = val;
data_type = type;
}
db_pgno_t last_pgno, new_pgno;
u_int32_t i, curpages, numpages;
- curpages = hp->hdr->spares[hp->hdr->ovfl_point] -
+ curpages = hp->hdr->spares[hp->hdr->ovfl_point] -
hp->hdr->spares[hp->hdr->ovfl_point - 1];
numpages = hp->hdr->ovfl_point + 1 - curpages;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)hash_rec.c 10.14 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)hash_rec.c 10.15 (Sleepycat) 12/4/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
/*
* __ham_copypage_recover --
* Recovery function for copypage.
- *
+ *
* PUBLIC: int __ham_copypage_recover
* PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
*/
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _btree_ext_h_
+#define _btree_ext_h_
int __bam_close __P((DB *));
int __bam_sync __P((DB *, int));
int __bam_cmp __P((DB *, const DBT *, EPG *));
int __bam_c_iclose __P((DB *, DBC *));
int __bam_get __P((DB *, DB_TXN *, DBT *, DBT *, int));
int __bam_ovfl_chk __P((DB *, CURSOR *, u_int32_t, int));
+int __bam_cprint __P((DB *));
int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, CURSOR *, int));
void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int));
void __bam_ca_dup __P((DB *,
db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t));
-void __bam_ca_move __P((DB *, BTREE *, db_pgno_t, db_pgno_t));
+void __bam_ca_move __P((DB *, db_pgno_t, db_pgno_t));
void __bam_ca_replace
__P((DB *, db_pgno_t, u_int32_t, ca_replace_arg));
void __bam_ca_split __P((DB *,
int __bam_bdup __P((DB *, DB *));
int __bam_new __P((DB *, u_int32_t, PAGE **));
int __bam_free __P((DB *, PAGE *));
+int __bam_lt __P((DB *));
int __bam_lget __P((DB *, int, db_pgno_t, db_lockmode_t, DB_LOCK *));
int __bam_lput __P((DB *, DB_LOCK));
int __bam_pget __P((DB *, PAGE **, db_pgno_t *, int));
int __ram_close __P((DB *));
int __ram_c_iclose __P((DB *, DBC *));
void __ram_ca __P((DB *, db_recno_t, ca_recno_arg));
+int __ram_cprint __P((DB *));
int __ram_getno __P((DB *, const DBT *, db_recno_t *, int));
int __ram_snapshot __P((DB *));
int __bam_rsearch __P((DB *, db_recno_t *, u_int, int, int *));
int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **));
int __bam_pg_free_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- u_int32_t, db_pgno_t, DB_LSN *, DBT *,
+ u_int32_t, db_pgno_t, DB_LSN *, const DBT *,
db_pgno_t));
int __bam_pg_free_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *,
- DBT *));
+ const DBT *));
int __bam_split_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __bam_split_read __P((void *, __bam_split_args **));
int __bam_rsplit_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- u_int32_t, db_pgno_t, DBT *, db_pgno_t,
- DBT *, DB_LSN *));
+ u_int32_t, db_pgno_t, const DBT *, db_pgno_t,
+ const DBT *, DB_LSN *));
int __bam_rsplit_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __bam_rsplit_read __P((void *, __bam_rsplit_args **));
int __bam_repl_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, db_pgno_t, DB_LSN *, u_int32_t,
- u_int32_t, DBT *, DBT *, u_int32_t,
+ u_int32_t, const DBT *, const DBT *, u_int32_t,
u_int32_t));
int __bam_repl_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __bam_repl_read __P((void *, __bam_repl_args **));
int __bam_init_print __P((DB_ENV *));
int __bam_init_recover __P((DB_ENV *));
+#endif /* _btree_ext_h_ */
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _clib_ext_h_
+#define _clib_ext_h_
#ifdef __STDC__
void err __P((int eval, const char *, ...));
#else
#ifndef HAVE_VSNPRINTF
int vsnprintf();
#endif
+#endif /* _clib_ext_h_ */
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _common_ext_h_
+#define _common_ext_h_
int __db_appname __P((DB_ENV *,
APPNAME, const char *, const char *, int *, char **));
int __db_apprec __P((DB_ENV *, int));
size_t __db_shalloc_count __P((void *));
size_t __db_shsizeof __P((void *));
void __db_shalloc_dump __P((FILE *, void *));
-int __db_tablesize __P((int));
+int __db_tablesize __P((u_int));
void __db_hashinit __P((void *, int));
+#endif /* _common_ext_h_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db.h.src 10.97 (Sleepycat) 11/28/97
+ * @(#)db.h.src 10.102 (Sleepycat) 1/18/98
*/
#ifndef _DB_H_
#define DB_VERSION_MAJOR 2
#define DB_VERSION_MINOR 3
-#define DB_VERSION_PATCH 14
-#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.14: (11/28/97)"
+#define DB_VERSION_PATCH 16
+#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.16: (1/19/98)"
typedef u_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset type. */
DB_LOCKTAB *lk_info; /* Return from lock_open(). */
u_int8_t *lk_conflicts; /* Two dimensional conflict matrix. */
int lk_modes; /* Number of lock modes in table. */
- unsigned int lk_max; /* Maximum number of locks. */
+ u_int lk_max; /* Maximum number of locks. */
u_int32_t lk_detect; /* Deadlock detect on every conflict. */
/* Logging. */
#define DB_RE_PAD 0x004000 /* DB_PAD (internal). */
#define DB_RE_RENUMBER 0x008000 /* DB_RENUMBER (internal). */
#define DB_RE_SNAPSHOT 0x010000 /* DB_SNAPSHOT (internal). */
-
u_int32_t flags;
};
int db_value_set __P((int, int));
char *db_version __P((int *, int *, int *));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int lock_vec __P((DB_LOCKTAB *,
u_int32_t, int, DB_LOCKREQ *, int, DB_LOCKREQ **));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
u_int32_t st_scount; /* Total writes to the log. */
u_int32_t st_region_wait; /* Region lock granted after wait. */
u_int32_t st_region_nowait; /* Region lock granted without wait. */
+ u_int32_t st_cur_file; /* Current log file number. */
+ u_int32_t st_cur_offset; /* Current log file offset. */
};
#if defined(__cplusplus)
int log_unlink __P((const char *, int, DB_ENV *));
int log_unregister __P((DB_LOG *, u_int32_t));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int memp_trickle __P((DB_MPOOL *, int, int *));
int memp_unlink __P((const char *, int, DB_ENV *));
#if defined(__cplusplus)
-};
+}
#endif
/*******************************************************
int txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t)));
int txn_unlink __P((const char *, int, DB_ENV *));
#if defined(__cplusplus)
-};
+}
#endif
-#ifdef DB_DBM_HSEARCH
+#ifndef DB_DBM_HSEARCH
+#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */
+#endif
+#if DB_DBM_HSEARCH != 0
/*******************************************************
* Dbm/Ndbm historic interfaces.
*******************************************************/
int dsize;
} datum;
+/*
+ * Translate DBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ *
+ * The global variables dbrdonly, dirf and pagf were not retained when
+ * 4BSD replaced the dbm interface with ndbm, and are not support here.
+ */
+#define dbminit(a) __db_dbm_init(a)
+#if !defined(__cplusplus)
+#define delete(a) __db_dbm_delete(a)
+#endif
+#define fetch(a) __db_dbm_fetch(a)
+#define firstkey __db_dbm_firstkey
+#define nextkey(a) __db_dbm_nextkey(a)
+#define store(a, b) __db_dbm_store(a, b)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
-int dbminit __P((char *));
-#if !defined(__cplusplus)
-int delete __P((datum));
+int __db_dbm_init __P((char *));
+int __db_dbm_delete __P((datum));
+int __db_dbm_dbrdonly __P((void));
+int __db_dbm_dirf __P((void));
+datum __db_dbm_fetch __P((datum));
+datum __db_dbm_firstkey __P((void));
+datum __db_dbm_nextkey __P((datum));
+int __db_dbm_pagf __P((void));
+int __db_dbm_store __P((datum, datum));
+#if defined(__cplusplus)
+}
#endif
-datum fetch __P((datum));
-datum firstkey __P((void));
-datum nextkey __P((datum));
-int store __P((datum, datum));
/*
- * !!!
- * Don't prototype:
- *
- * dbm_clearerr(DBM *db);
- * dbm_dirfno(DBM *db);
- * dbm_error(DBM *db);
- * dbm_pagfno(DBM *db);
- * dbm_rdonly(DBM *db);
- *
- * they weren't documented and were historically implemented as #define's.
+ * Translate NDBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
*/
-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));
+#define dbm_clearerr(a) __db_ndbm_clearerr(a)
+#define dbm_close(a) __db_ndbm_close(a)
+#define dbm_delete(a, b) __db_ndbm_delete(a, b)
+#define dbm_dirfno(a) __db_ndbm_dirfno(a)
+#define dbm_error(a) __db_ndbm_error(a)
+#define dbm_fetch(a, b) __db_ndbm_fetch(a, b)
+#define dbm_firstkey(a) __db_ndbm_firstkey(a)
+#define dbm_nextkey(a) __db_ndbm_nextkey(a)
+#define dbm_open(a, b, c) __db_ndbm_open(a, b, c)
+#define dbm_pagfno(a) __db_ndbm_pagfno(a)
+#define dbm_rdonly(a) __db_ndbm_rdonly(a)
+#define dbm_store(a, b, c, d) __db_ndbm_store(a, b, c, d)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
-};
+extern "C" {
+#endif
+int __db_ndbm_clearerr __P((DBM *));
+void __db_ndbm_close __P((DBM *));
+int __db_ndbm_delete __P((DBM *, datum));
+int __db_ndbm_dirfno __P((DBM *));
+int __db_ndbm_error __P((DBM *));
+datum __db_ndbm_fetch __P((DBM *, datum));
+datum __db_ndbm_firstkey __P((DBM *));
+datum __db_ndbm_nextkey __P((DBM *));
+DBM *__db_ndbm_open __P((const char *, int, int));
+int __db_ndbm_pagfno __P((DBM *));
+int __db_ndbm_rdonly __P((DBM *));
+int __db_ndbm_store __P((DBM *, datum, datum, int));
+#if defined(__cplusplus)
+}
#endif
/*******************************************************
void *data;
} ENTRY;
+/*
+ * Translate HSEARCH calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ */
+#define hcreate(a) __db_hcreate(a)
+#define hdestroy __db_hdestroy
+#define hsearch(a, b) __db_hsearch(a, b)
+
+/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
-int hcreate __P((unsigned int));
-void hdestroy __P((void));
-ENTRY *hsearch __P((ENTRY, ACTION));
+int __db_hcreate __P((unsigned int));
+void __db_hdestroy __P((void));
+ENTRY *__db_hsearch __P((ENTRY, ACTION));
#if defined(__cplusplus)
-};
+}
#endif
#endif /* DB_DBM_HSEARCH */
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)db_185.h.src 8.4 (Sleepycat) 9/16/97
+ * @(#)db_185.h.src 8.5 (Sleepycat) 1/15/98
*/
#ifndef _DB_185_H_
DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
#if defined(__cplusplus)
-};
+}
#endif
#endif /* !_DB_185_H_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_am.h 10.7 (Sleepycat) 10/25/97
+ * @(#)db_am.h 10.8 (Sleepycat) 1/8/98
*/
#ifndef _DB_AM_H
#define _DB_AM_H
(void)func(logp, dbtp, lsnp, redo, info);
#else
#define REC_PRINT(func) \
- info = info; /* XXX: Shut the compiler up. */
+ COMPQUIET(info, NULL);
#endif
#include "db_auto.h"
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _db_ext_h_
+#define _db_ext_h_
int __db_pgerr __P((DB *, db_pgno_t));
int __db_pgfmt __P((DB *, db_pgno_t));
int __db_addrem_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
- size_t, DBT *, DBT *, DB_LSN *));
+ size_t, const DBT *, const DBT *, DB_LSN *));
int __db_addrem_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __db_addrem_read __P((void *, __db_addrem_args **));
int __db_split_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- u_int32_t, u_int32_t, db_pgno_t, DBT *,
+ u_int32_t, u_int32_t, db_pgno_t, const DBT *,
DB_LSN *));
int __db_split_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __db_big_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, u_int32_t, db_pgno_t, db_pgno_t,
- db_pgno_t, DBT *, DB_LSN *, DB_LSN *,
+ db_pgno_t, const DBT *, DB_LSN *, DB_LSN *,
DB_LSN *));
int __db_big_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __db_addpage_read __P((void *, __db_addpage_args **));
int __db_debug_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- DBT *, u_int32_t, DBT *, DBT *,
+ const DBT *, u_int32_t, const DBT *, const DBT *,
u_int32_t));
int __db_debug_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __db_txnlist_init __P((void *));
int __db_txnlist_add __P((void *, u_int32_t));
int __db_txnlist_find __P((void *, u_int32_t));
+void __db_txnlist_print __P((void *));
void __db_txnlist_end __P((void *));
int __db_dput __P((DB *,
DBT *, PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **)));
int __db_drem __P((DB *,
PAGE **, u_int32_t, int (*)(DB *, PAGE *)));
int __db_dend __P((DB *, db_pgno_t, PAGE **));
- int __db_ditem __P((DB *, PAGE *, int, u_int32_t));
+ int __db_ditem __P((DB *, PAGE *, u_int32_t, u_int32_t));
int __db_pitem
__P((DB *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *));
int __db_relink __P((DB *, PAGE *, PAGE **, int));
void *, u_int32_t, void **, u_int32_t *, void *(*)(size_t)));
int __db_gethandle __P((DB *, int (*)(DB *, DB *), DB **));
int __db_puthandle __P((DB *));
+#endif /* _db_ext_h_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_int.h.src 10.37 (Sleepycat) 11/25/97
+ * @(#)db_int.h.src 10.41 (Sleepycat) 1/8/98
*/
#ifndef _DB_INTERNAL_H_
/*******************************************************
* General purpose constants and macros.
*******************************************************/
-#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */
#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */
+#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */
#define DB_MIN_PGSIZE 0x000200 /* Minimum page size. */
#define DB_MAX_PGSIZE 0x010000 /* Maximum page size. */
#define DB_MINCACHE 10 /* Minimum cached pages */
+#define MEGABYTE 1048576
+
+/*
+ * If we are unable to determine the underlying filesystem block size, use
+ * 8K on the grounds that most OS's use less than 8K as their VM page size.
+ */
+#define DB_DEF_IOSIZE (8 * 1024)
+
/*
* Aligning items to particular sizes or in pages or memory. ALIGNP is a
* separate macro, as we've had to cast the pointer to different integral
#undef DB_LINE
#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
+/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */
+#define COMPQUIET(n, v) (n) = (v)
+
/*******************************************************
* Files.
*******************************************************/
/*
* The offset of a mutex in memory.
+ *
+ * !!!
+ * Not an off_t, so backing file offsets MUST be less than 4Gb. See the
+ * off field of the db_mutex_t as well.
*/
-#define MUTEX_LOCK_OFFSET(a, b) ((off_t)((u_int8_t *)b - (u_int8_t *)a))
+#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_int8_t *)b - (u_int8_t *)a))
typedef struct _db_mutex_t {
#ifdef HAVE_SPINLOCKS
- tsl_t tsl_resource; /* Resource test and set. */
+ tsl_t tsl_resource; /* Resource test and set. */
#ifdef DEBUG
- u_long pid; /* Lock holder: 0 or process pid. */
+ u_long pid; /* Lock holder: 0 or process pid. */
#endif
#else
- off_t off; /* Backing file offset. */
- u_long pid; /* Lock holder: 0 or process pid. */
+ u_int32_t off; /* Backing file offset. */
+ u_long pid; /* Lock holder: 0 or process pid. */
#endif
u_int32_t spins; /* Spins before block. */
u_int32_t mutex_set_wait; /* Granted after wait. */
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _hash_ext_h_
+#define _hash_ext_h_
int __ham_open __P((DB *, DB_INFO *));
int __ham_close __P((DB *));
int __ham_c_iclose __P((DB *, DBC *));
int __ham_expand_table __P((HTAB *));
u_int32_t __ham_call_hash __P((HTAB *, u_int8_t *, int32_t));
int __ham_init_dbt __P((DBT *, u_int32_t, void **, u_int32_t *));
-void __ham_c_update __P((HTAB *,
- HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
+void __ham_c_update
+ __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
int __ham_hdup __P((DB *, DB *));
int __ham_insdel_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
- DB_LSN *, DBT *, DBT *));
+ DB_LSN *, const DBT *, const DBT *));
int __ham_insdel_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __ham_insdel_read __P((void *, __ham_insdel_args **));
int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **));
int __ham_splitdata_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- u_int32_t, u_int32_t, db_pgno_t, DBT *,
+ u_int32_t, u_int32_t, db_pgno_t, const DBT *,
DB_LSN *));
int __ham_splitdata_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __ham_replace_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, db_pgno_t, u_int32_t, DB_LSN *,
- int32_t, DBT *, DBT *, u_int32_t));
+ int32_t, const DBT *, const DBT *, u_int32_t));
int __ham_replace_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __ham_replace_read __P((void *, __ham_replace_args **));
int __ham_copypage_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
- DB_LSN *, db_pgno_t, DB_LSN *, DBT *));
+ DB_LSN *, db_pgno_t, DB_LSN *, const DBT *));
int __ham_copypage_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __ham_copypage_read __P((void *, __ham_copypage_args **));
int __ham_copypage_recover
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __ham_stat __P((DB *, FILE *));
+#endif /* _hash_ext_h_ */
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _lock_ext_h_
+#define _lock_ext_h_
+void __lock_dump_region __P((DB_LOCKTAB *, u_int));
+int __lock_is_locked
+ __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t));
int __lock_getobj __P((DB_LOCKTAB *,
- u_int32_t, DBT *, u_int32_t type, DB_LOCKOBJ **));
-int __lock_cmp __P((DBT *, DB_LOCKOBJ *));
+ u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **));
+int __lock_cmp __P((const DBT *, DB_LOCKOBJ *));
int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *));
-int __lock_ohash __P((DBT *));
+int __lock_ohash __P((const DBT *));
u_int32_t __lock_locker_hash __P((u_int32_t));
u_int32_t __lock_lhash __P((DB_LOCKOBJ *));
+#endif /* _lock_ext_h_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)log.h 10.16 (Sleepycat) 11/9/97
+ * @(#)log.h 10.19 (Sleepycat) 1/17/98
*/
#ifndef _LOG_H_
struct __log; typedef struct __log LOG;
struct __log_persist; typedef struct __log_persist LOGP;
-#define MEGABYTE (1024 * 1024)
-
#define MAXLFNAME 99999 /* Maximum log file name. */
#define LFNAME "log.%05d" /* Log file name template. */
/* Default log name. */
#define DB_DEFAULT_LOG_FILE "__db_log.share"
-#define DEFAULT_MAX (10 * 1048576) /* 10 Mb. */
+#define DEFAULT_MAX (10 * MEGABYTE) /* 10 Mb. */
/* Macros to lock/unlock the region and threads. */
#define LOCK_LOGTHREAD(dblp) \
/*
* The s_lsn LSN is the last LSN that we know is on disk, not just
- * written, by synced.
+ * written, but synced.
*/
DB_LSN s_lsn; /* LSN of the last sync. */
size_t name_off; /* Name offset. */
};
+/* File open/close register log record opcodes. */
+#define LOG_CHECKPOINT 1 /* Checkpoint: file name/id dump. */
+#define LOG_CLOSE 2 /* File close. */
+#define LOG_OPEN 3 /* File open. */
+
#include "log_auto.h"
#include "log_ext.h"
#endif /* _LOG_H_ */
u_int32_t type;
DB_TXN *txnid;
DB_LSN prev_lsn;
+ u_int32_t opcode;
DBT name;
DBT uid;
u_int32_t id;
DBTYPE ftype;
} __log_register_args;
-
-#define DB_log_unregister (DB_log_BEGIN + 2)
-
-typedef struct _log_unregister_args {
- u_int32_t type;
- DB_TXN *txnid;
- DB_LSN prev_lsn;
- u_int32_t id;
-} __log_unregister_args;
-
#endif
/* DO NOT EDIT: automatically built by dist/distrib. */
-int __log_find __P((DB_LOG *, int *));
+#ifndef _log_ext_h_
+#define _log_ext_h_
+int __log_find __P((DB_LOG *, int, int *));
int __log_valid __P((DB_LOG *, LOG *, int));
int __log_register_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- DBT *, DBT *, u_int32_t, DBTYPE));
+ u_int32_t, const DBT *, const DBT *, u_int32_t,
+ DBTYPE));
int __log_register_print
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __log_register_read __P((void *, __log_register_args **));
-int __log_unregister_log
- __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- u_int32_t));
-int __log_unregister_print
- __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
-int __log_unregister_read __P((void *, __log_unregister_args **));
int __log_init_print __P((DB_ENV *));
int __log_init_recover __P((DB_ENV *));
int __log_findckp __P((DB_LOG *, DB_LSN *));
int __log_name __P((DB_LOG *, int, char **));
int __log_register_recover
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
-int __log_unregister_recover
- __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __log_add_logid __P((DB_LOG *, DB *, u_int32_t));
int __db_fileid_to_db __P((DB_LOG *, DB **, u_int32_t));
void __log_close_files __P((DB_LOG *));
void __log_rem_logid __P((DB_LOG *, u_int32_t));
+#endif /* _log_ext_h_ */
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)mp.h 10.22 (Sleepycat) 11/28/97
+ * @(#)mp.h 10.25 (Sleepycat) 1/8/98
*/
struct __bh; typedef struct __bh BH;
* Acquire the region lock.
* Find the buffer header.
* Increment the reference count (guarantee the buffer stays).
- * If the BH_LOCKED flag is set (I/O is going on):
- * Release the region lock.
- * Request the buffer lock.
- * The I/O will complete...
- * Acquire the buffer lock.
- * Release the buffer lock.
- * Acquire the region lock.
+ * While the BH_LOCKED flag is set (I/O is going on) {
+ * Release the region lock.
+ * Explicitly yield the processor if it's not the first pass
+ * through this loop, otherwise, we can simply spin because
+ * we'll be simply switching between the two locks.
+ * Request the buffer lock.
+ * The I/O will complete...
+ * Acquire the buffer lock.
+ * Release the buffer lock.
+ * Acquire the region lock.
+ * }
* Return the buffer.
*
* Reading/writing a buffer:
* Set the BH_LOCKED flag.
* Acquire the buffer lock (guaranteed not to block).
* Release the region lock.
- * Do the I/O and/or initialize buffer contents.
+ * Do the I/O and/or initialize the buffer contents.
+ * Release the buffer lock.
+ * At this point, the buffer lock is available, but the logical
+ * operation (flagged by BH_LOCKED) is not yet completed. For
+ * this reason, among others, threads checking the BH_LOCKED flag
+ * must loop around their test.
* Acquire the region lock.
* Clear the BH_LOCKED flag.
* Release the region lock.
- * Release the buffer lock.
- * If reading, return the buffer.
+ * Return/discard the buffer.
*
* Pointers to DB_MPOOL, MPOOL, DB_MPOOLFILE and MPOOLFILE structures are not
* reacquired when a region lock is reacquired because they couldn't have been
*/
#define LOCKINIT(dbmp, mutexp) \
if (F_ISSET(dbmp, MP_LOCKHANDLE | MP_LOCKREGION)) \
- (void)__db_mutex_init(mutexp, (dbmp)->fd)
+ (void)__db_mutex_init(mutexp, \
+ MUTEX_LOCK_OFFSET((dbmp)->maddr, mutexp))
#define LOCKHANDLE(dbmp, mutexp) \
if (F_ISSET(dbmp, MP_LOCKHANDLE)) \
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _mp_ext_h_
+#define _mp_ext_h_
int __memp_bhwrite
__P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *));
int __memp_pgread __P((DB_MPOOLFILE *, BH *, int));
int __memp_ropen
__P((DB_MPOOL *, const char *, size_t, int, int));
int __memp_rclose __P((DB_MPOOL *));
+#endif /* _mp_ext_h_ */
/* DO NOT EDIT: automatically built by dist/distrib. */
-void __db_mutex_init __P((db_mutex_t *, off_t));
+#ifndef _mutex_ext_h_
+#define _mutex_ext_h_
+void __db_mutex_init __P((db_mutex_t *, u_int32_t));
int __db_mutex_lock __P((db_mutex_t *, int));
int __db_mutex_unlock __P((db_mutex_t *, int));
+#endif /* _mutex_ext_h_ */
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _os_ext_h_
+#define _os_ext_h_
int __db_abspath __P((const char *));
void *__db_calloc __P((size_t, size_t));
void *__db_malloc __P((size_t));
void *__db_realloc __P((void *, size_t));
+int __os_oldwin __P((void));
int __os_dirlist __P((const char *, char ***, int *));
void __os_dirfree __P((char **, int));
int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *));
int __os_sleep __P((u_long, u_long));
int __os_spin __P((void));
int __os_exists __P((const char *, int *));
-int __os_ioinfo __P((const char *, int, off_t *, off_t *));
+int __os_ioinfo
+ __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *));
int __db_unlink __P((const char *));
+#endif /* _os_ext_h_ */
* Copyright (c) 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)os_func.h 10.4 (Sleepycat) 11/28/97
+ * @(#)os_func.h 10.5 (Sleepycat) 12/4/97
*/
/* Calls which can be replaced by the application. */
__P((const char *, int *));
void (*db_free) __P((void *)); /* DB_FUNC_FREE */
int (*db_fsync) __P((int)); /* DB_FUNC_FSYNC */
- int (*db_ioinfo) /* DB_FUNC_IOINFO */
- __P((const char *, int, off_t *, off_t *));
+ int (*db_ioinfo) __P((const char *, /* DB_FUNC_IOINFO */
+ int, u_int32_t *, u_int32_t *, u_int32_t *));
void *(*db_malloc) __P((size_t)); /* DB_FUNC_MALLOC */
int (*db_map) /* DB_FUNC_MAP */
__P((int, size_t, int, int, void **));
/* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _txn_ext_h_
+#define _txn_ext_h_
int __txn_regop_log
__P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
u_int32_t));
int __txn_regop_recover
__P((DB_LOG *, DBT *, DB_LSN *, int, void *));
int __txn_ckp_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
+#endif /* _txn_ext_h_ */
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)lock.c 10.41 (Sleepycat) 11/28/97";
+static const char sccsid[] = "@(#)lock.c 10.43 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
u_int maxlocks;
u_int32_t i;
int fd, lock_modes, nelements, ret;
- u_int8_t *conflicts, *curaddr;
+ const u_int8_t *conflicts;
+ u_int8_t *curaddr;
maxlocks = dbenv == NULL || dbenv->lk_max == 0 ?
DB_LOCK_DEFAULT_N : dbenv->lk_max;
lock_modes = dbenv == NULL || dbenv->lk_modes == 0 ?
DB_LOCK_RW_N : dbenv->lk_modes;
conflicts = dbenv == NULL || dbenv->lk_conflicts == NULL ?
- (u_int8_t *)db_rw_conflicts : dbenv->lk_conflicts;
+ db_rw_conflicts : dbenv->lk_conflicts;
if ((ret =
__db_rcreate(dbenv, DB_APP_NONE, path, DB_DEFAULT_LOCK_FILE, mode,
newl->holder = locker;
newl->refcount = 1;
- if ((ret =
- __lock_getobj(lt, 0, (DBT *)obj, DB_LOCK_OBJTYPE, &sh_obj)) != 0)
+ if ((ret = __lock_getobj(lt, 0, obj, DB_LOCK_OBJTYPE, &sh_obj)) != 0)
return (ret);
lrp = lt->region; /* getobj might have grown */
}
#ifdef DEBUG
+/*
+ * __lock_dump_region --
+ *
+ * PUBLIC: void __lock_dump_region __P((DB_LOCKTAB *, u_int));
+ */
void
__lock_dump_region(lt, flags)
DB_LOCKTAB *lt;
- unsigned long flags;
+ u_int flags;
{
struct __db_lock *lp;
DB_LOCKOBJ *op;
}
}
+/*
+ * __lock_is_locked --
+ *
+ * PUBLIC: int __lock_is_locked
+ * PUBLIC: __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t));
+ */
int
__lock_is_locked(lt, locker, dbt, mode)
DB_LOCKTAB *lt;
db_pgno_t pgno;
size_t obj;
u_int8_t *ptr;
- char *mode, *stat;
+ const char *mode, *status;
switch (lp->mode) {
case DB_LOCK_IREAD:
}
switch (lp->status) {
case DB_LSTAT_ABORTED:
- stat = "ABORT";
+ status = "ABORT";
break;
case DB_LSTAT_ERR:
- stat = "ERROR";
+ status = "ERROR";
break;
case DB_LSTAT_FREE:
- stat = "FREE";
+ status = "FREE";
break;
case DB_LSTAT_HELD:
- stat = "HELD";
+ status = "HELD";
break;
case DB_LSTAT_NOGRANT:
- stat = "NONE";
+ status = "NONE";
break;
case DB_LSTAT_WAITING:
- stat = "WAIT";
+ status = "WAIT";
break;
case DB_LSTAT_PENDING:
- stat = "PENDING";
+ status = "PENDING";
break;
default:
- stat = "UNKNOWN";
+ status = "UNKNOWN";
break;
}
printf("\t%lx\t%s\t%lu\t%s\t",
- (u_long)lp->holder, mode, (u_long)lp->refcount, stat);
+ (u_long)lp->holder, mode, (u_long)lp->refcount, status);
lockobj = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj);
ptr = SH_DBT_PTR(&lockobj->lockobj);
printf("\n");
}
}
-
#endif
static int
/*
* PUBLIC: int __lock_getobj __P((DB_LOCKTAB *,
- * PUBLIC: u_int32_t, DBT *, u_int32_t type, DB_LOCKOBJ **));
+ * PUBLIC: u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **));
*/
int
__lock_getobj(lt, locker, dbt, type, objp)
DB_LOCKTAB *lt;
u_int32_t locker, type;
- DBT *dbt;
+ const DBT *dbt;
DB_LOCKOBJ **objp;
{
DB_LOCKREGION *lrp;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)lock_util.c 10.4 (Sleepycat) 7/22/97";
+static const char sccsid[] = "@(#)lock_util.c 10.5 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* that it just returns true on equal and 0 on not-equal. Therefore this
* cannot be used as a sort function; its purpose is to be used as a
* hash comparison function.
- * PUBLIC: int __lock_cmp __P((DBT *, DB_LOCKOBJ *));
+ * PUBLIC: int __lock_cmp __P((const DBT *, DB_LOCKOBJ *));
*/
int
__lock_cmp(dbt, lock_obj)
- DBT *dbt;
+ const DBT *dbt;
DB_LOCKOBJ *lock_obj;
{
void *obj_data;
}
/*
- * PUBLIC: int __lock_ohash __P((DBT *));
+ * PUBLIC: int __lock_ohash __P((const DBT *));
*/
int
__lock_ohash(dbt)
- DBT *dbt;
+ const DBT *dbt;
{
return (__ham_func5(dbt->data, dbt->size));
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log.c 10.34 (Sleepycat) 11/28/97";
+static const char sccsid[] = "@(#)log.c 10.39 (Sleepycat) 1/17/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* Find a log file. If none exist, we simply return, leaving
* everything initialized to a new log.
*/
- if ((ret = __log_find(dblp, &cnt)) != 0)
+ if ((ret = __log_find(dblp, 0, &cnt)) != 0)
return (ret);
if (cnt == 0)
return (0);
- /* We have a log file name, find the last one. */
- while (cnt < MAXLFNAME)
- if (__log_valid(dblp, lp, ++cnt) != 0) {
- --cnt;
- break;
- }
-
/*
* We have the last useful log file and we've loaded any persistent
* information. Pretend that the log is larger than it can possibly
- * be, and read this file, looking for a checkpoint and its end.
+ * be, and read the last file, looking for the last checkpoint and
+ * the log's end.
*/
- dblp->c_lsn.file = cnt;
- dblp->c_lsn.offset = 0;
- lsn = dblp->c_lsn;
lp->lsn.file = cnt + 1;
lp->lsn.offset = 0;
+ lsn.file = cnt;
+ lsn.offset = 0;
/* Set the cursor. Shouldn't fail, leave error messages on. */
memset(&dbt, 0, sizeof(dbt));
* one in the last log file. Start searching.
*/
while (!found_checkpoint && cnt > 1) {
- dblp->c_lsn.file = --cnt;
- dblp->c_lsn.offset = 0;
- lsn = dblp->c_lsn;
+ lsn.file = --cnt;
+ lsn.offset = 0;
/* Set the cursor. Shouldn't fail, leave error messages on. */
if ((ret = __log_get(dblp, &lsn, &dbt, DB_SET, 0)) != 0)
}
/* If we never find a checkpoint, that's okay, just 0 it out. */
- if (!found_checkpoint) {
- lp->c_lsn.file = 1;
- lp->c_lsn.offset = 0;
- }
+ if (!found_checkpoint)
+ ZERO_LSN(lp->c_lsn);
__db_err(dblp->dbenv,
"Recovering the log: last valid LSN: file: %lu offset %lu",
(u_long)lp->lsn.file, (u_long)lp->lsn.offset);
- /* Reset the cursor. */
- ZERO_LSN(dblp->c_lsn);
-
return (0);
}
/*
* __log_find --
- * Try to find a log file.
+ * Try to find a log file. If find_first is set, valp will contain
+ * the number of the first log file, else it will contain the number of
+ * the last log file.
*
- * PUBLIC: int __log_find __P((DB_LOG *, int *));
+ * PUBLIC: int __log_find __P((DB_LOG *, int, int *));
*/
int
-__log_find(dblp, valp)
+__log_find(dblp, find_first, valp)
DB_LOG *dblp;
- int *valp;
+ int find_first, *valp;
{
int cnt, fcnt, logval, ret;
const char *dir;
char **names, *p, *q;
+ *valp = 0;
+
/* Find the directory name. */
if ((ret = __log_name(dblp, 1, &p)) != 0)
return (ret);
* Search for a valid log file name, return a value of 0 on
* failure.
*/
- *valp = 0;
for (cnt = fcnt, logval = 0; --cnt >= 0;)
if (strncmp(names[cnt], "log.", sizeof("log.") - 1) == 0) {
logval = atoi(names[cnt] + 4);
if (logval != 0 &&
- __log_valid(dblp, dblp->lp, logval) == 0) {
- *valp = logval;
+ __log_valid(dblp, dblp->lp, logval) == 0)
break;
- }
}
/* Discard the list. */
__db_dirfree(names, fcnt);
- return (ret);
+ /* We have a valid log file, find either the first or last one. */
+ if (find_first) {
+ for (; logval > 0; --logval)
+ if (__log_valid(dblp, dblp->lp, logval - 1) != 0)
+ break;
+ } else
+ for (; logval < MAXLFNAME; ++logval)
+ if (__log_valid(dblp, dblp->lp, logval + 1) != 0)
+ break;
+ *valp = logval;
+
+ return (0);
}
/*
(*gspp)->st_region_nowait = lp->rlayout.lock.mutex_set_nowait;
(*gspp)->st_region_wait = lp->rlayout.lock.mutex_set_wait;
+
+ (*gspp)->st_cur_file = lp->lsn.file;
+ (*gspp)->st_cur_offset = lp->lsn.offset;
+
UNLOCK_LOGREGION(dblp);
return (0);
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)log.src 10.3 (Sleepycat) 8/20/97
+ * @(#)log.src 10.4 (Sleepycat) 1/17/98
*
* This is the source file used to create the logging functions for the
* log package. Each access method (or set of routines wishing to register
*/
PREFIX log
-/* Used for registering new name/id translations. */
+/* Used for registering name/id translations at open or close. */
BEGIN register
+ARG opcode u_int32_t lu
DBT name DBT s
DBT uid DBT s
ARG id u_int32_t lu
ARG ftype DBTYPE lx
END
-
-BEGIN unregister
-ARG id u_int32_t lu
-END
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_archive.c 10.29 (Sleepycat) 11/12/97";
+static const char sccsid[] = "@(#)log_archive.c 10.30 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
int array_size, n, ret;
char **array, **arrayp, *name, *p, *pref, buf[MAXPATHLEN];
- fnum = 0; /* XXX: Shut the compiler up. */
+ COMPQUIET(fnum, 0);
#define OKFLAGS (DB_ARCH_ABS | DB_ARCH_DATA | DB_ARCH_LOG)
if (flags != 0) {
/*
* PUBLIC: int __log_register_log
* PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: DBT *, DBT *, u_int32_t, DBTYPE));
+ * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t,
+ * PUBLIC: DBTYPE));
*/
int __log_register_log(logp, txnid, ret_lsnp, flags,
- name, uid, id, ftype)
+ opcode, name, uid, id, ftype)
DB_LOG *logp;
DB_TXN *txnid;
DB_LSN *ret_lsnp;
u_int32_t flags;
- DBT *name;
- DBT *uid;
+ u_int32_t opcode;
+ const DBT *name;
+ const DBT *uid;
u_int32_t id;
DBTYPE ftype;
{
} else
lsnp = &txnid->last_lsn;
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
+ + sizeof(opcode)
+ sizeof(u_int32_t) + (name == NULL ? 0 : name->size)
+ sizeof(u_int32_t) + (uid == NULL ? 0 : uid->size)
+ sizeof(id)
bp += sizeof(txn_num);
memcpy(bp, lsnp, sizeof(DB_LSN));
bp += sizeof(DB_LSN);
+ memcpy(bp, &opcode, sizeof(opcode));
+ bp += sizeof(opcode);
if (name == NULL) {
zero = 0;
memcpy(bp, &zero, sizeof(u_int32_t));
(u_long)argp->txnid->txnid,
(u_long)argp->prev_lsn.file,
(u_long)argp->prev_lsn.offset);
+ printf("\topcode: %lu\n", (u_long)argp->opcode);
printf("\tname: ");
for (i = 0; i < argp->name.size; i++) {
c = ((char *)argp->name.data)[i];
bp += sizeof(argp->txnid->txnid);
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
bp += sizeof(DB_LSN);
+ memcpy(&argp->opcode, bp, sizeof(argp->opcode));
+ bp += sizeof(argp->opcode);
memcpy(&argp->name.size, bp, sizeof(u_int32_t));
bp += sizeof(u_int32_t);
argp->name.data = bp;
return (0);
}
-/*
- * PUBLIC: int __log_unregister_log
- * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
- * PUBLIC: u_int32_t));
- */
-int __log_unregister_log(logp, txnid, ret_lsnp, flags,
- id)
- DB_LOG *logp;
- DB_TXN *txnid;
- DB_LSN *ret_lsnp;
- u_int32_t flags;
- u_int32_t id;
-{
- DBT logrec;
- DB_LSN *lsnp, null_lsn;
- u_int32_t rectype, txn_num;
- int ret;
- u_int8_t *bp;
-
- rectype = DB_log_unregister;
- txn_num = txnid == NULL ? 0 : txnid->txnid;
- if (txnid == NULL) {
- null_lsn.file = 0;
- null_lsn.offset = 0;
- lsnp = &null_lsn;
- } else
- lsnp = &txnid->last_lsn;
- logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
- + sizeof(id);
- if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL)
- return (ENOMEM);
-
- bp = logrec.data;
- memcpy(bp, &rectype, sizeof(rectype));
- bp += sizeof(rectype);
- memcpy(bp, &txn_num, sizeof(txn_num));
- bp += sizeof(txn_num);
- memcpy(bp, lsnp, sizeof(DB_LSN));
- bp += sizeof(DB_LSN);
- memcpy(bp, &id, sizeof(id));
- bp += sizeof(id);
-#ifdef DEBUG
- if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
- fprintf(stderr, "Error in log record length");
-#endif
- ret = __log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
- if (txnid != NULL)
- txnid->last_lsn = *ret_lsnp;
- __db_free(logrec.data);
- return (ret);
-}
-
-/*
- * PUBLIC: int __log_unregister_print
- * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
- */
-int
-__log_unregister_print(notused1, dbtp, lsnp, notused3, notused4)
- DB_LOG *notused1;
- DBT *dbtp;
- DB_LSN *lsnp;
- int notused3;
- void *notused4;
-{
- __log_unregister_args *argp;
- u_int32_t i;
- int c, ret;
-
- i = 0;
- c = 0;
- notused1 = NULL;
- notused3 = 0;
- notused4 = NULL;
-
- if ((ret = __log_unregister_read(dbtp->data, &argp)) != 0)
- return (ret);
- printf("[%lu][%lu]log_unregister: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
- (u_long)lsnp->file,
- (u_long)lsnp->offset,
- (u_long)argp->type,
- (u_long)argp->txnid->txnid,
- (u_long)argp->prev_lsn.file,
- (u_long)argp->prev_lsn.offset);
- printf("\tid: %lu\n", (u_long)argp->id);
- printf("\n");
- __db_free(argp);
- return (0);
-}
-
-/*
- * PUBLIC: int __log_unregister_read __P((void *, __log_unregister_args **));
- */
-int
-__log_unregister_read(recbuf, argpp)
- void *recbuf;
- __log_unregister_args **argpp;
-{
- __log_unregister_args *argp;
- u_int8_t *bp;
-
- argp = (__log_unregister_args *)__db_malloc(sizeof(__log_unregister_args) +
- sizeof(DB_TXN));
- if (argp == NULL)
- return (ENOMEM);
- argp->txnid = (DB_TXN *)&argp[1];
- bp = recbuf;
- memcpy(&argp->type, bp, sizeof(argp->type));
- bp += sizeof(argp->type);
- memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
- bp += sizeof(argp->txnid->txnid);
- memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
- bp += sizeof(DB_LSN);
- memcpy(&argp->id, bp, sizeof(argp->id));
- bp += sizeof(argp->id);
- *argpp = argp;
- return (0);
-}
-
/*
* PUBLIC: int __log_init_print __P((DB_ENV *));
*/
if ((ret = __db_add_recovery(dbenv,
__log_register_print, DB_log_register)) != 0)
return (ret);
- if ((ret = __db_add_recovery(dbenv,
- __log_unregister_print, DB_log_unregister)) != 0)
- return (ret);
return (0);
}
if ((ret = __db_add_recovery(dbenv,
__log_register_recover, DB_log_register)) != 0)
return (ret);
- if ((ret = __db_add_recovery(dbenv,
- __log_unregister_recover, DB_log_unregister)) != 0)
- return (ret);
return (0);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_get.c 10.22 (Sleepycat) 11/22/97";
+static const char sccsid[] = "@(#)log_get.c 10.24 (Sleepycat) 1/17/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
nlsn = dblp->c_lsn;
switch (flags) {
case DB_CHECKPOINT:
- nlsn = dblp->lp->c_lsn;
+ nlsn = lp->c_lsn;
if (IS_ZERO_LSN(nlsn)) {
__db_err(dblp->dbenv,
"log_get: unable to find checkpoint record: no checkpoint set.");
}
/* FALLTHROUGH */
case DB_FIRST: /* Find the first log record. */
- /*
- * Find any log file. Note, we may have only entered records
- * in the buffer, and not yet written a log file.
- */
- if ((ret = __log_find(dblp, &cnt)) != 0) {
- __db_err(dblp->dbenv,
- "log_get: unable to find the first record: no log files found.");
+ /* Find the first log file. */
+ if ((ret = __log_find(dblp, 1, &cnt)) != 0)
goto err2;
- }
- /* If there's anything in the buffer, it belongs to file 1. */
+ /*
+ * We may have only entered records in the buffer, and not
+ * yet written a log file. If no log files were found and
+ * there's anything in the buffer, it belongs to file 1.
+ */
if (cnt == 0)
cnt = 1;
- /* Now go backwards to find the smallest one. */
- for (; cnt > 1; --cnt)
- if (__log_valid(dblp, NULL, cnt) != 0) {
- ++cnt;
- break;
- }
nlsn.file = cnt;
nlsn.offset = 0;
break;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_put.c 10.22 (Sleepycat) 11/12/97";
+static const char sccsid[] = "@(#)log_put.c 10.24 (Sleepycat) 1/17/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
const DBT *dbt;
int flags;
{
- DBT t;
- DBT fid_dbt;
+ DBT fid_dbt, t;
DB_LSN r_unused;
FNAME *fnp;
LOG *lp;
for (fnp = SH_TAILQ_FIRST(&dblp->lp->fq, __fname);
fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) {
+ memset(&t, 0, sizeof(t));
t.data = R_ADDR(dblp, fnp->name_off);
t.size = strlen(t.data) + 1;
memset(&fid_dbt, 0, sizeof(fid_dbt));
fid_dbt.data = R_ADDR(dblp, fnp->fileid_off);
fid_dbt.size = DB_FILE_ID_LEN;
- if ((ret = __log_register_log(dblp, NULL, &r_unused,
- 0, &t, &fid_dbt, fnp->id, fnp->s_type)) != 0)
+ if ((ret = __log_register_log(dblp, NULL, &r_unused, 0,
+ LOG_CHECKPOINT, &t, &fid_dbt, fnp->id, fnp->s_type))
+ != 0)
return (ret);
}
}
/*
* If the LSN is less than the last-sync'd LSN, we're done. Note,
- * the last-sync LSN saved in s_lsn is the LSN of the first byte
+ * the last-sync LSN saved in s_lsn is the LSN of the first byte
* we absolutely know has been written to disk, so the test is <=.
*/
if (lsn->file < lp->s_lsn.file ||
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_rec.c 10.14 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)log_rec.c 10.16 (Sleepycat) 1/17/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#ifdef DEBUG_RECOVER
__log_register_print(logp, dbtp, lsnp, redo, info);
#endif
- info = info; /* XXX: Shut the compiler up. */
- lsnp = lsnp;
+ COMPQUIET(info, NULL);
+ COMPQUIET(lsnp, NULL);
F_SET(logp, DB_AM_RECOVER);
if ((ret = __log_register_read(dbtp->data, &argp)) != 0)
goto out;
- ret = __log_open_file(logp,
- argp->uid.data, argp->name.data, argp->ftype, argp->id);
- if (ret == ENOENT) {
- if (redo == TXN_OPENFILES)
- __db_err(logp->dbenv,
- "warning: file %s not found", argp->name.data);
- ret = 0;
- }
-
-out: F_CLR(logp, DB_AM_RECOVER);
- if (argp != NULL)
- __db_free(argp);
- return (ret);
-}
-
-/*
- * PUBLIC: int __log_unregister_recover
- * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
- */
-int
-__log_unregister_recover(logp, dbtp, lsnp, redo, info)
- DB_LOG *logp;
- DBT *dbtp;
- DB_LSN *lsnp;
- int redo;
- void *info;
-{
- __log_unregister_args *argp;
- int ret;
-
-#ifdef DEBUG_RECOVER
- __log_unregister_print(logp, dbtp, lsnp, redo, info);
-#endif
- info = info; /* XXX: Shut the compiler up. */
- lsnp = lsnp;
-
- if (redo == TXN_OPENFILES ||
- redo == TXN_BACKWARD_ROLL || redo == TXN_UNDO)
- return (0);
-
- F_SET(logp, DB_AM_RECOVER);
- if ((ret = __log_unregister_read(dbtp->data, &argp)) != 0)
- goto out;
-
- /*
- * If the file is deleted, then we can just ignore this close.
- * Otherwise, we'd better have a valid dbp that we should either
- * close or whose reference count should be decremented.
- */
- LOCK_LOGTHREAD(logp);
- if (logp->dbentry[argp->id].dbp == NULL) {
- if (!logp->dbentry[argp->id].deleted)
- ret = EINVAL;
- } else if (--logp->dbentry[argp->id].refcount == 0) {
- ret = logp->dbentry[argp->id].dbp->close(
- logp->dbentry[argp->id].dbp, 0);
- logp->dbentry[argp->id].dbp = NULL;
+ if ((argp->opcode == LOG_CHECKPOINT && redo == TXN_OPENFILES) ||
+ (argp->opcode == LOG_OPEN &&
+ (redo == TXN_REDO || redo == TXN_OPENFILES ||
+ redo == TXN_FORWARD_ROLL)) ||
+ (argp->opcode == LOG_CLOSE &&
+ (redo == TXN_UNDO || redo == TXN_BACKWARD_ROLL))) {
+ /*
+ * If we are redoing an open or undoing a close, then we need
+ * to open a file.
+ */
+ ret = __log_open_file(logp,
+ argp->uid.data, argp->name.data, argp->ftype, argp->id);
+ if (ret == ENOENT) {
+ if (redo == TXN_OPENFILES)
+ __db_err(logp->dbenv,
+ "warning: file %s not found",
+ argp->name.data);
+ ret = 0;
+ }
+ } else if (argp->opcode != LOG_CHECKPOINT) {
+ /*
+ * If we are redoing a close or undoing an open, then we need
+ * to close the file.
+ *
+ * If the file is deleted, then we can just ignore this close.
+ * Otherwise, we'd better have a valid dbp that we should either
+ * close or whose reference count should be decremented.
+ */
+ LOCK_LOGTHREAD(logp);
+ if (logp->dbentry[argp->id].dbp == NULL) {
+ if (!logp->dbentry[argp->id].deleted)
+ ret = EINVAL;
+ } else if (--logp->dbentry[argp->id].refcount == 0) {
+ ret = logp->dbentry[argp->id].dbp->close(
+ logp->dbentry[argp->id].dbp, 0);
+ logp->dbentry[argp->id].dbp = NULL;
+ }
+ UNLOCK_LOGTHREAD(logp);
}
- UNLOCK_LOGTHREAD(logp);
out: F_CLR(logp, DB_AM_RECOVER);
if (argp != NULL)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_register.c 10.12 (Sleepycat) 9/29/97";
+static const char sccsid[] = "@(#)log_register.c 10.14 (Sleepycat) 1/19/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
DBTYPE type;
u_int32_t *idp;
{
- DBT r_name;
- DBT fid_dbt;
+ DBT fid_dbt, r_name;
DB_LSN r_unused;
FNAME *fnp;
size_t len;
R_ADDR(dblp, fnp->fileid_off), DB_FILE_ID_LEN)) {
++fnp->ref;
fid = fnp->id;
- if (!F_ISSET(dblp, DB_AM_RECOVER) &&
- (ret = __log_add_logid(dblp, dbp, fid) != 0))
- goto err;
- goto ret1;
+ goto found;
}
}
SH_TAILQ_INSERT_HEAD(&dblp->lp->fq, fnp, q, __fname);
inserted = 1;
- /* Log the registry. */
+found: /* Log the registry. */
if (!F_ISSET(dblp, DB_AM_RECOVER)) {
r_name.data = (void *)name; /* XXX: Yuck! */
r_name.size = strlen(name) + 1;
fid_dbt.data = dbp->lock.fileid;
fid_dbt.size = DB_FILE_ID_LEN;
if ((ret = __log_register_log(dblp, NULL, &r_unused,
- 0, &r_name, &fid_dbt, fid, type)) != 0)
+ 0, LOG_OPEN, &r_name, &fid_dbt, fid, type)) != 0)
goto err;
if ((ret = __log_add_logid(dblp, dbp, fid)) != 0)
goto err;
__db_shalloc_free(dblp->addr, fnp);
}
-ret1: UNLOCK_LOGREGION(dblp);
+ UNLOCK_LOGREGION(dblp);
if (fullname != NULL)
FREES(fullname);
DB_LOG *dblp;
u_int32_t fid;
{
+ DBT fid_dbt, r_name;
DB_LSN r_unused;
FNAME *fnp;
int ret;
ret = 0;
LOCK_LOGREGION(dblp);
- /* Unlog the registry. */
- if (!F_ISSET(dblp, DB_AM_RECOVER) &&
- (ret = __log_unregister_log(dblp, NULL, &r_unused, 0, fid)) != 0)
- return (ret);
-
/* Find the entry in the log. */
for (fnp = SH_TAILQ_FIRST(&dblp->lp->fq, __fname);
fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname))
goto ret1;
}
- /* If more than 1 reference, decrement the reference and return. */
- if (fnp->ref > 1) {
- --fnp->ref;
- goto ret1;
+ /* Unlog the registry. */
+ if (!F_ISSET(dblp, DB_AM_RECOVER)) {
+ memset(&r_name, 0, sizeof(r_name));
+ r_name.data = R_ADDR(dblp, fnp->name_off);
+ r_name.size = strlen(r_name.data) + 1;
+ memset(&fid_dbt, 0, sizeof(fid_dbt));
+ fid_dbt.data = R_ADDR(dblp, fnp->fileid_off);
+ fid_dbt.size = DB_FILE_ID_LEN;
+ if ((ret = __log_register_log(dblp, NULL, &r_unused,
+ 0, LOG_CLOSE, &r_name, &fid_dbt, fid, fnp->s_type)) != 0)
+ goto ret1;
}
- /* Free the unique file information, name and structure. */
- __db_shalloc_free(dblp->addr, R_ADDR(dblp, fnp->fileid_off));
- __db_shalloc_free(dblp->addr, R_ADDR(dblp, fnp->name_off));
- SH_TAILQ_REMOVE(&dblp->lp->fq, fnp, q, __fname);
- __db_shalloc_free(dblp->addr, fnp);
+ /*
+ * If more than 1 reference, just decrement the reference and return.
+ * Otherwise, free the unique file information, name and structure.
+ */
+ if (fnp->ref > 1)
+ --fnp->ref;
+ else {
+ __db_shalloc_free(dblp->addr, R_ADDR(dblp, fnp->fileid_off));
+ __db_shalloc_free(dblp->addr, R_ADDR(dblp, fnp->name_off));
+ SH_TAILQ_REMOVE(&dblp->lp->fq, fnp, q, __fname);
+ __db_shalloc_free(dblp->addr, fnp);
+ }
/*
* Remove from the process local table. If this operation is taking
__log_rem_logid(dblp, fid);
ret1: UNLOCK_LOGREGION(dblp);
-
return (ret);
}
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "1996, 1997");
+"), "1996, 1997, 1998");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
++cp;
val.data = cp;
- val.size = &line[n] - cp;
+ val.size = (&line[n] - cp) + 1;
/* Store the value. */
status = output->put (output, &key, &val, R_NOOVERWRITE);
no_more = db->seq (db, &key, &val, R_FIRST);
while (!no_more)
{
- printf ("%.*s %.*s\n", (int) key.size, (char *) key.data, (int) val.size,
+ printf ("%.*s %s\n", (int) key.size, (char *) key.data,
(char *) val.data);
no_more = db->seq (db, &key, &val, R_NEXT);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_bh.c 10.23 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_bh.c 10.28 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
/* Call any pgin function. */
pgin: ret = mfp->ftype == 0 ? 0 : __memp_pg(dbmfp, bhp, 1);
- /* Reacquire the region lock. */
+ /* Unlock the buffer and reacquire the region lock. */
+err: UNLOCKBUFFER(dbmp, bhp);
LOCKREGION(dbmp);
- /* If the pgin function succeeded, the data is now valid. */
- if (ret == 0)
+ /*
+ * If no errors occurred, the data is now valid, clear the BH_TRASH
+ * flag; regardless, clear the lock bit and let other threads proceed.
+ */
+ F_CLR(bhp, BH_LOCKED);
+ if (ret == 0) {
F_CLR(bhp, BH_TRASH);
- /* Update the statistics. */
- if (can_create) {
- ++dbmp->mp->stat.st_page_create;
- ++mfp->stat.st_page_create;
- } else {
- ++dbmp->mp->stat.st_page_in;
- ++mfp->stat.st_page_in;
- }
-
- if (0) {
-err: LOCKREGION(dbmp);
+ /* Update the statistics. */
+ if (can_create) {
+ ++dbmp->mp->stat.st_page_create;
+ ++mfp->stat.st_page_create;
+ } else {
+ ++dbmp->mp->stat.st_page_in;
+ ++mfp->stat.st_page_in;
+ }
}
- /* Release the buffer. */
- F_CLR(bhp, BH_LOCKED);
- UNLOCKBUFFER(dbmp, bhp);
-
return (ret);
}
MPOOLFILE *mfp;
size_t pagesize;
ssize_t nw;
- int callpgin, ret;
+ int callpgin, ret, syncfail;
const char *fail;
dbmp = dbmfp->dbmp;
callpgin = 0;
pagesize = mfp->stat.st_pagesize;
- F_SET(bhp, BH_LOCKED);
+ /*
+ * Check the dirty bit -- this buffer may have been written since we
+ * decided to write it.
+ */
+ if (!F_ISSET(bhp, BH_DIRTY)) {
+ if (wrotep != NULL)
+ *wrotep = 1;
+ return (0);
+ }
+
LOCKBUFFER(dbmp, bhp);
+
+ /*
+ * If there were two writers, we may have just been waiting while the
+ * other writer completed I/O on this buffer. Check the dirty bit one
+ * more time.
+ */
+ if (!F_ISSET(bhp, BH_DIRTY)) {
+ UNLOCKBUFFER(dbmp, bhp);
+
+ if (wrotep != NULL)
+ *wrotep = 1;
+ return (0);
+ }
+
+ F_SET(bhp, BH_LOCKED);
UNLOCKREGION(dbmp);
if (restartp != NULL)
goto err;
/*
- * Call any pgout function. We set the callpgin flag so that on
- * error we flag that the contents of the buffer may be trash.
+ * Call any pgout function. We set the callpgin flag so that we flag
+ * that the contents of the buffer will need to be passed through pgin
+ * before they are reused.
*/
if (mfp->ftype == 0)
ret = 0;
* between the failing clauses to __db_lseek and __db_write and
* this ret != 0.
*/
- fail = NULL;
+ COMPQUIET(fail, NULL);
goto syserr;
}
if (wrotep != NULL)
*wrotep = 1;
- /* Reacquire the region lock. */
+ /* Unlock the buffer and reacquire the region lock. */
+ UNLOCKBUFFER(dbmp, bhp);
LOCKREGION(dbmp);
- /* Clean up the flags based on a successful write. */
- F_SET(bhp, BH_CALLPGIN);
+ /*
+ * Clean up the flags based on a successful write.
+ *
+ * If we rewrote the page, it will need processing by the pgin
+ * routine before reuse.
+ */
+ if (callpgin)
+ F_SET(bhp, BH_CALLPGIN);
F_CLR(bhp, BH_DIRTY | BH_LOCKED);
- ++mp->stat.st_page_clean;
- --mp->stat.st_page_dirty;
-
- UNLOCKBUFFER(dbmp, bhp);
-
/*
* If we write a buffer for which a checkpoint is waiting, update
* the count of pending buffers (both in the mpool as a whole and
*
* XXX:
* We ignore errors from the sync -- it makes no sense to return an
- * error to the calling process, so set a flag causing the sync to
- * be retried later.
- *
- * If the buffer we wrote has a LSN larger than the current largest
- * we've written for this checkpoint, update the saved value.
+ * error to the calling process, so set a flag causing the checkpoint
+ * to be retried later.
*/
if (F_ISSET(bhp, BH_WRITE)) {
+ if (mfp->lsn_cnt == 1) {
+ UNLOCKREGION(dbmp);
+ syncfail = __db_fsync(dbmfp->fd) != 0;
+ LOCKREGION(dbmp);
+ if (syncfail)
+ F_SET(mp, MP_LSN_RETRY);
+
+ }
+
+ F_CLR(bhp, BH_WRITE);
+
+ /*
+ * If the buffer just written has a larger LSN than the current
+ * max LSN written for this checkpoint, update the saved value.
+ */
if (log_compare(&lsn, &mp->lsn) > 0)
mp->lsn = lsn;
- F_CLR(bhp, BH_WRITE);
--mp->lsn_cnt;
-
- if (--mfp->lsn_cnt == 0 && __db_fsync(dbmfp->fd) != 0)
- F_SET(mp, MP_LSN_RETRY);
+ --mfp->lsn_cnt;
}
+ /* Update the page clean/dirty statistics. */
+ ++mp->stat.st_page_clean;
+ --mp->stat.st_page_dirty;
+
/* Update I/O statistics. */
++mp->stat.st_page_out;
++mfp->stat.st_page_out;
syserr: __db_err(dbenv, "%s: %s failed for page %lu",
__memp_fn(dbmfp), fail, (u_long)bhp->pgno);
-err: UNLOCKBUFFER(dbmp, bhp);
+err: /* Unlock the buffer and reacquire the region lock. */
+ UNLOCKBUFFER(dbmp, bhp);
LOCKREGION(dbmp);
+
+ /*
+ * Clean up the flags based on a failure.
+ *
+ * The page remains dirty but we remove our lock. If we rewrote the
+ * page, it will need processing by the pgin routine before reuse.
+ */
if (callpgin)
F_SET(bhp, BH_CALLPGIN);
F_CLR(bhp, BH_LOCKED);
+
return (ret);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_fget.c 10.32 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_fget.c 10.33 (Sleepycat) 12/2/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* discarded we know the buffer can't move and its contents
* can't change.
*/
- if (F_ISSET(bhp, BH_LOCKED)) {
+ for (cnt = 0; F_ISSET(bhp, BH_LOCKED); ++cnt) {
UNLOCKREGION(dbmp);
+
+ /*
+ * Sleep so that we don't simply spin, switching locks.
+ * (See the comment in include/mp.h.)
+ */
+ if (cnt != 0 &&
+ (__db_yield == NULL || __db_yield() != 0))
+ __db_sleep(0, 1);
+
LOCKBUFFER(dbmp, bhp);
/* Waiting for I/O to finish... */
UNLOCKBUFFER(dbmp, bhp);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_fopen.c 10.32 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_fopen.c 10.37 (Sleepycat) 1/18/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include "common_ext.h"
static int __memp_mf_close __P((DB_MPOOL *, DB_MPOOLFILE *));
-static int __memp_mf_open __P((DB_MPOOL *, DB_MPOOLFILE *,
- const char *, int, size_t, off_t, int, DBT *, u_int8_t *, MPOOLFILE **));
+static int __memp_mf_open __P((DB_MPOOL *, const char *,
+ int, size_t, db_pgno_t, int, DBT *, u_int8_t *, MPOOLFILE **));
/*
* memp_fopen --
{
DB_ENV *dbenv;
DB_MPOOLFILE *dbmfp;
- off_t size;
+ db_pgno_t last_pgno;
+ size_t size;
+ u_int32_t mbytes, bytes;
int ret;
u_int8_t idbuf[DB_FILE_ID_LEN];
char *rpath;
goto err;
}
size = 0;
+ last_pgno = 0;
} else {
/* Get the real name for this file and open it. */
if ((ret = __db_appname(dbenv,
}
/* Don't permit files that aren't a multiple of the pagesize. */
- if ((ret = __db_ioinfo(rpath, dbmfp->fd, &size, NULL)) != 0) {
+ if ((ret = __db_ioinfo(rpath,
+ dbmfp->fd, &mbytes, &bytes, NULL)) != 0) {
__db_err(dbenv, "%s: %s", rpath, strerror(ret));
goto err;
}
- if (size % pagesize) {
+ if (bytes % pagesize) {
__db_err(dbenv,
"%s: file size not a multiple of the pagesize",
rpath);
ret = EINVAL;
goto err;
}
+ size = mbytes * MEGABYTE + bytes;
+ last_pgno = size == 0 ? 0 : (size - 1) / pagesize;
/*
* Get the file id if we weren't given one. Generated file id's
goto err;
fileid = idbuf;
}
+ FREES(rpath);
}
/*
LOCKREGION(dbmp);
if (mfp == NULL)
- ret = __memp_mf_open(dbmp, dbmfp, path,
- ftype, pagesize, size, lsn_offset, pgcookie, fileid, &mfp);
+ ret = __memp_mf_open(dbmp, path, ftype,
+ pagesize, last_pgno, lsn_offset, pgcookie, fileid, &mfp);
else {
++mfp->ref;
ret = 0;
if (LF_ISSET(DB_NOMMAP))
F_CLR(mfp, MP_CAN_MMAP);
if (size > (dbenv == NULL || dbenv->mp_mmapsize == 0 ?
- DB_MAXMMAPSIZE : (off_t)dbenv->mp_mmapsize))
+ DB_MAXMMAPSIZE : dbenv->mp_mmapsize))
F_CLR(mfp, MP_CAN_MMAP);
}
dbmfp->addr = NULL;
* Open an MPOOLFILE.
*/
static int
-__memp_mf_open(dbmp, dbmfp, path,
- ftype, pagesize, size, lsn_offset, pgcookie, fileid, retp)
+__memp_mf_open(dbmp, path,
+ ftype, pagesize, last_pgno, lsn_offset, pgcookie, fileid, retp)
DB_MPOOL *dbmp;
- DB_MPOOLFILE *dbmfp;
const char *path;
int ftype, lsn_offset;
size_t pagesize;
- off_t size;
+ db_pgno_t last_pgno;
DBT *pgcookie;
u_int8_t *fileid;
MPOOLFILE **retp;
* it away.
*/
mfp->stat.st_pagesize = pagesize;
- mfp->last_pgno = size == 0 ? 0 : (size - 1) / mfp->stat.st_pagesize;
+ mfp->last_pgno = last_pgno;
F_SET(mfp, MP_CAN_MMAP);
if (ISTEMPORARY)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_fput.c 10.16 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_fput.c 10.17 (Sleepycat) 12/20/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#ifdef DEBUG
if (bhp->ref == 0) {
__db_err(dbmp->dbenv,
- "Internal error: bhp->ref on page %lu went negative.",
+ "Unpinned page returned: reference count on page %lu went negative.",
(u_long)bhp->pgno);
abort();
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_pr.c 10.20 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_pr.c 10.21 (Sleepycat) 1/6/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include "db_shash.h"
#include "mp.h"
-void __memp_debug __P((DB_MPOOL *, FILE *, int));
-
static void __memp_pbh __P((FILE *, DB_MPOOL *, BH *, int));
static void __memp_pdbmf __P((FILE *, DB_MPOOLFILE *, int));
static void __memp_pmf __P((FILE *, MPOOLFILE *, int));
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_sync.c 10.17 (Sleepycat) 11/26/97";
+static const char sccsid[] = "@(#)mp_sync.c 10.19 (Sleepycat) 12/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
DB_ENV *dbenv;
MPOOL *mp;
MPOOLFILE *mfp;
- int ar_cnt, cnt, nalloc, next, notused, ret, wrote;
+ int ar_cnt, cnt, nalloc, next, ret, wrote;
dbenv = dbmp->dbenv;
/* Write the buffer. */
mfp = R_ADDR(dbmp, bharray[next]->mf_offset);
- ret =
- __memp_bhwrite(dbmp, mfp, bharray[next], ¬used, &wrote);
+ ret = __memp_bhwrite(dbmp, mfp, bharray[next], NULL, &wrote);
/* Release the buffer. */
--bharray[next]->ref;
/* If there's an error, release the rest of the buffers. */
if (ret != 0 || !wrote) {
- while (++next < ar_cnt)
- --bharray[next]->ref;
-
- if (ret != 0)
- goto err;
-
/*
* Any process syncing the shared memory buffer pool
* had better be able to write to any underlying file.
* Be understanding, but firm, on this point.
*/
- if (!wrote) {
+ if (ret == 0) {
__db_err(dbenv, "%s: unable to flush page: %lu",
__memp_fns(dbmp, mfp),
(u_long)bharray[next]->pgno);
ret = EPERM;
- goto err;
}
+
+ while (++next < ar_cnt)
+ --bharray[next]->ref;
+ goto err;
}
}
ret = mp->lsn_cnt ? DB_INCOMPLETE : 0;
BH *bhp, **bharray;
DB_MPOOL *dbmp;
size_t mf_offset;
- int ar_cnt, cnt, nalloc, next, pincnt, notused, ret, wrote;
+ int ar_cnt, cnt, nalloc, next, pincnt, ret, wrote;
dbmp = dbmfp->dbmp;
}
/* Write the buffer. */
- ret = __memp_pgwrite(dbmfp, bharray[next], ¬used, &wrote);
+ ret = __memp_pgwrite(dbmfp, bharray[next], NULL, &wrote);
/* Release the buffer. */
--bharray[next]->ref;
MPOOL *mp;
MPOOLFILE *mfp;
u_long total;
- int notused, ret, wrote;
+ int ret, wrote;
mp = dbmp->mp;
if (nwrotep != NULL)
if (F_ISSET(mfp, MP_TEMP))
continue;
- if ((ret =
- __memp_bhwrite(dbmp, mfp, bhp, ¬used, &wrote)) != 0)
+ if ((ret = __memp_bhwrite(dbmp, mfp, bhp, NULL, &wrote)) != 0)
goto err;
/*
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mutex.c 10.29 (Sleepycat) 11/25/97";
+static const char sccsid[] = "@(#)mutex.c 10.32 (Sleepycat) 1/16/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* __db_mutex_init --
* Initialize a DB mutex structure.
*
- * PUBLIC: void __db_mutex_init __P((db_mutex_t *, off_t));
+ * PUBLIC: void __db_mutex_init __P((db_mutex_t *, u_int32_t));
*/
void
__db_mutex_init(mp, off)
db_mutex_t *mp;
- off_t off;
+ u_int32_t off;
{
#ifdef DEBUG
if ((ALIGNTYPE)mp & (MUTEX_ALIGNMENT - 1)) {
memset(mp, 0, sizeof(db_mutex_t));
#ifdef HAVE_SPINLOCKS
+ COMPQUIET(off, 0);
+
TSL_INIT(&mp->tsl_resource);
mp->spins = __os_spin();
#else
#ifdef HAVE_SPINLOCKS
int nspins;
+ COMPQUIET(fd, 0);
+
for (usecs = MS(10);;) {
/* Try and acquire the uncontested resource lock for N spins. */
for (nspins = mp->spins; nspins > 0; --nspins)
/* Acquire an exclusive kernel lock. */
k_lock.l_type = F_WRLCK;
if (fcntl(fd, F_SETLKW, &k_lock))
- return (1);
+ return (errno);
/* If the resource tsl is still available, it's ours. */
if (mp->pid == 0) {
/* Release the kernel lock. */
k_lock.l_type = F_UNLCK;
if (fcntl(fd, F_SETLK, &k_lock))
- return (1);
+ return (errno);
/*
* If we got the resource tsl we're done.
#endif
#ifdef HAVE_SPINLOCKS
+ COMPQUIET(fd, 0);
+
#ifdef DEBUG
mp->pid = 0;
#endif
--- /dev/null
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1997
+ * Sleepycat Software. All rights reserved.
+ */
+
+#include "config.h"
+
+#ifndef lint
+static const char sccsid[] = "@(#)os_alloc.c 10.1 (Sleepycat) 12/1/97";
+#endif /* not lint */
+
+#ifndef NO_SYSTEM_INCLUDES
+#include <sys/types.h>
+
+#include <errno.h>
+#include <string.h>
+#endif
+
+#include "db_int.h"
+
+/*
+ * XXX
+ * Correct for systems that return NULL when you allocate 0 bytes of memory.
+ * There are several places in DB where we allocate the number of bytes held
+ * by the key/data item, and it can be 0. Correct here so that malloc never
+ * returns a NULL for that reason (which behavior is permitted by ANSI). We
+ * could make these calls macros on non-Alpha architectures (that's where we
+ * saw the problem), but it's probably not worth the autoconf complexity.
+ */
+/*
+ * __db_calloc --
+ * The calloc(3) function for DB.
+ *
+ * PUBLIC: void *__db_calloc __P((size_t, size_t));
+ */
+void *
+__db_calloc(num, size)
+ size_t num, size;
+{
+ void *p;
+
+ size *= num;
+ if ((p = __db_jump.db_malloc(size == 0 ? 1 : size)) != NULL)
+ memset(p, 0, size);
+ return (p);
+}
+
+/*
+ * __db_malloc --
+ * The malloc(3) function for DB.
+ *
+ * PUBLIC: void *__db_malloc __P((size_t));
+ */
+void *
+__db_malloc(size)
+ size_t size;
+{
+ return (__db_jump.db_malloc(size == 0 ? 1 : size));
+}
+
+/*
+ * __db_realloc --
+ * The realloc(3) function for DB.
+ *
+ * PUBLIC: void *__db_realloc __P((void *, size_t));
+ */
+void *
+__db_realloc(ptr, size)
+ void *ptr;
+ size_t size;
+{
+ return (__db_jump.db_realloc(ptr, size == 0 ? 1 : size));
+}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)os_config.c 10.9 (Sleepycat) 11/28/97";
+static const char sccsid[] = "@(#)os_config.c 10.12 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include "db_int.h"
+/*
+ * __os_oldwin --
+ * Return if Windows 95 (as opposed to Windows NT).
+ *
+ * PUBLIC: int __os_oldwin __P((void));
+ */
+int
+__os_oldwin()
+{
+#ifdef _WIN32
+ return ((GetVersion() & 0x80000000) != 0);
+#else
+ return (0);
+#endif
+}
+
/*
* XXX
* We provide our own extern declarations so that we don't collide with
imported extern void *realloc __P((void *, size_t));
imported extern int unlink __P((const char *));
imported extern ssize_t write __P((int, const void *, size_t));
-imported extern void *memset __P((void *, int, size_t));
/*
* __db_jump --
__db_jump.db_fsync = (int (*) __P((int)))func;
break;
case DB_FUNC_IOINFO:
- __db_jump.db_ioinfo =
- (int (*) __P((const char *, int, off_t *, off_t *)))func;
+ __db_jump.db_ioinfo = (int (*) __P((const char *,
+ int, u_int32_t *, u_int32_t *, u_int32_t *)))func;
break;
case DB_FUNC_MALLOC:
__db_jump.db_malloc = (void *(*) __P((size_t)))func;
}
return (0);
}
-
-/*
- * XXX
- * Correct for systems that return NULL when you allocate 0 bytes of memory.
- * There are several places in DB where we allocate the number of bytes held
- * by the key/data item, and it can be 0. Correct here so that malloc never
- * returns a NULL for that reason.
- */
-/*
- * __db_calloc --
- * The calloc(3) function for DB.
- *
- * PUBLIC: void *__db_calloc __P((size_t, size_t));
- */
-void *
-__db_calloc(num, size)
- size_t num, size;
-{
- void *p;
-
- size *= num;
- if ((p = __db_jump.db_malloc(size == 0 ? 1 : size)) != NULL)
- memset(p, 0, size);
- return (p);
-}
-
-/*
- * __db_malloc --
- * The malloc(3) function for DB.
- *
- * PUBLIC: void *__db_malloc __P((size_t));
- */
-void *
-__db_malloc(size)
- size_t size;
-{
- return (__db_jump.db_malloc(size == 0 ? 1 : size));
-}
-
-/*
- * __db_realloc --
- * The realloc(3) function for DB.
- *
- * PUBLIC: void *__db_realloc __P((void *, size_t));
- */
-void *
-__db_realloc(ptr, size)
- void *ptr;
- size_t size;
-{
- return (__db_jump.db_realloc(ptr, size == 0 ? 1 : size));
-}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)os_stat.c 10.8 (Sleepycat) 10/25/97";
+static const char sccsid[] = "@(#)os_stat.c 10.11 (Sleepycat) 1/8/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
* Return file size and I/O size; abstracted to make it easier
* to replace.
*
- * PUBLIC: int __os_ioinfo __P((const char *, int, off_t *, off_t *));
+ * PUBLIC: int __os_ioinfo
+ * PUBLIC: __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *));
*/
int
-__os_ioinfo(path, fd, sizep, iop)
+__os_ioinfo(path, fd, mbytesp, bytesp, iosizep)
const char *path;
int fd;
- off_t *sizep, *iop;
+ u_int32_t *mbytesp, *bytesp, *iosizep;
{
struct stat sb;
+ COMPQUIET(path, NULL);
+
if (fstat(fd, &sb) == -1)
return (errno);
/* Return the size of the file. */
- if (sizep != NULL)
- *sizep = sb.st_size;
+ if (mbytesp != NULL)
+ *mbytesp = sb.st_size / MEGABYTE;
+ if (bytesp != NULL)
+ *bytesp = sb.st_size % MEGABYTE;
- /*
- * Return the underlying filesystem blocksize, if available. Default
- * to 8K on the grounds that most OS's use less than 8K as their VM
- * page size.
- */
+ /* Return the underlying filesystem blocksize, if available. */
#ifdef HAVE_ST_BLKSIZE
- if (iop != NULL)
- *iop = sb.st_blksize;
+ if (iosizep != NULL)
+ *iosizep = sb.st_blksize;
#else
- if (iop != NULL)
- *iop = 8 * 1024;
+ if (iosizep != NULL)
+ *iosizep = DB_DEF_IOSIZE;
#endif
return (0);
}
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_checkpoint.c 10.12 (Sleepycat) 9/4/97";
+static const char sccsid[] = "@(#)db_checkpoint.c 10.14 (Sleepycat) 1/17/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
void usage __P((void));
int interrupted;
-time_t now; /* Checkpoint time. */
const char
*progname = "db_checkpoint"; /* Program name. */
}
(void)time(&now);
fprintf(fp,
- "%s: %lu %s", progname, (u_long)getpid(), ctime(&now));
+ "%.24s: %lu %s", progname, (u_long)getpid(), ctime(&now));
fclose(fp);
} else
(void)remove(fname);
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_deadlock.c 10.16 (Sleepycat) 10/14/97";
+static const char sccsid[] = "@(#)db_deadlock.c 10.17 (Sleepycat) 1/15/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
}
(void)time(&now);
fprintf(fp,
- "%s: %lu %s", progname, (u_long)getpid(), ctime(&now));
+ "%.24s: %lu %s", progname, (u_long)getpid(), ctime(&now));
fclose(fp);
} else
(void)remove(fname);
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_load.c 10.14 (Sleepycat) 10/19/97";
+static const char sccsid[] = "@(#)db_load.c 10.15 (Sleepycat) 12/29/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
extern int optind;
DB *dbp;
DBT key, data;
- DBTYPE argtype, headertype;
+ DBTYPE argtype, dbtype;
DB_ENV *dbenv;
DB_INFO dbinfo;
db_recno_t recno;
- int ch, pflag;
+ int ch, no_header, pflag;
char **clist, **clp, *home;
/* Allocate enough room for configuration arguments. */
err(1, NULL);
home = NULL;
- argtype = DB_UNKNOWN;
- while ((ch = getopt(argc, argv, "c:f:h:t:")) != EOF)
+ no_header = 0;
+ argtype = dbtype = DB_UNKNOWN;
+ while ((ch = getopt(argc, argv, "c:f:h:Tt:")) != EOF)
switch (ch) {
case 'c':
*clp++ = optarg;
case 'h':
home = optarg;
break;
+ case 'T':
+ no_header = pflag = 1;
+ break;
case 't':
if (strcmp(optarg, "btree") == 0) {
argtype = DB_BTREE;
argtype = DB_HASH;
break;
}
+ if (strcmp(optarg, "recno") == 0) {
+ argtype = DB_RECNO;
+ break;
+ }
usage();
/* NOTREACHED */
case '?':
dbenv = db_init(home);
memset(&dbinfo, 0, sizeof(DB_INFO));
- /* Read the header. */
- rheader(&headertype, &pflag, &dbinfo);
+ /*
+ * Read the header. If there isn't any header, we're expecting flat
+ * text, set the pflag appropriately.
+ */
+ if (no_header)
+ dbtype = argtype;
+ else {
+ rheader(&dbtype, &pflag, &dbinfo);
+ if (argtype != DB_UNKNOWN) {
+ /* Conversion to/from recno is prohibited. */
+ if ((dbtype == DB_RECNO && argtype != DB_RECNO) ||
+ (argtype == DB_RECNO && dbtype != DB_RECNO))
+ errx(1,
+ "databases of type recno may not be converted");
+ dbtype = argtype;
+ }
+ }
+ if (dbtype == DB_UNKNOWN)
+ errx(1, "no database type specified");
/* Apply command-line configuration changes. */
configure(&dbinfo, clist);
- /* Conversion to/from recno is prohibited. */
- if (argtype != DB_UNKNOWN) {
- if (headertype == DB_RECNO)
- errx(1, "databases of type recno may not be converted");
- headertype = argtype;
- }
-
/* Open the DB file. */
- if ((errno = db_open(argv[0], headertype, DB_CREATE | DB_TRUNCATE,
+ if ((errno = db_open(argv[0], dbtype, DB_CREATE | DB_TRUNCATE,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
dbenv, &dbinfo, &dbp)) != 0)
err(1, "%s", argv[0]);
}
/* Get each key/data pair and add them to the database. */
- if (headertype == DB_RECNO) {
+ if (dbtype == DB_RECNO) {
key.data = &recno;
key.size = sizeof(recno);
for (recno = 1;; ++recno) {
*pflagp = 0;
for (lineno = 1;; ++lineno) {
+ /* If we don't see the expected information, it's an error. */
if (fscanf(stdin, "%[^=]=%s\n", name, value) != 2)
errx(1, "line %lu: unexpected format", lineno);
+
+ /* Check for the end of the header lines. */
if (strcmp(name, "HEADER") == 0)
break;
usage()
{
(void)fprintf(stderr,
-"usage: db_load [-c name=value] [-f file] [-h home] [-t btree | hash] db_file\n");
+"usage: db_load [-T]\n\t[-c name=value] [-f file] [-h home] [-t btree | hash] db_file\n");
exit(1);
}
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_printlog.c 10.10 (Sleepycat) 8/27/97";
+static const char sccsid[] = "@(#)db_printlog.c 10.11 (Sleepycat) 1/8/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
onint(signo)
int signo;
{
- signo = 1; /* XXX: Shut the compiler up. */
+ COMPQUIET(signo, 0);
+
interrupted = 1;
}
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_recover.c 10.16 (Sleepycat) 10/28/97";
+static const char sccsid[] = "@(#)db_recover.c 10.17 (Sleepycat) 1/15/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
dbenv = db_init(home, flags, verbose);
if (verbose) {
- __db_err(dbenv, "Recovery complete at %s", ctime(&now));
+ __db_err(dbenv, "Recovery complete at %.24s", ctime(&now));
__db_err(dbenv, "%s %lu %s [%lu][%lu]",
"Maximum transaction id",
(u_long)dbenv->tx_info->region->last_txnid,
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_stat.c 8.26 (Sleepycat) 11/2/97";
+static const char sccsid[] = "@(#)db_stat.c 8.30 (Sleepycat) 1/8/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
#undef stat
-#define MB 1048576
-#define DIVIDER "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
-
typedef enum { T_NOTSET, T_DB, T_LOG, T_MPOOL, T_TXN } test_t;
void btree_stats __P((DB *));
hash_stats(dbp)
DB *dbp;
{
+ COMPQUIET(dbp, NULL);
+
return;
}
printf("%#lx\tLog magic number.\n", (u_long)sp->st_magic);
printf("%lu\tLog version number.\n", (u_long)sp->st_version);
printf("%#o\tLog file mode.\n", sp->st_mode);
- if (sp->st_lg_max % MB == 0)
- printf("%luMb\tLog file size.\n", (u_long)sp->st_lg_max / MB);
+ if (sp->st_lg_max % MEGABYTE == 0)
+ printf("%luMb\tLog file size.\n",
+ (u_long)sp->st_lg_max / MEGABYTE);
else if (sp->st_lg_max % 1024 == 0)
printf("%luKb\tLog file size.\n", (u_long)sp->st_lg_max / 1024);
else
(u_long)sp->st_wc_mbytes, (u_long)sp->st_wc_bytes);
printf("%lu\tTotal log file writes.\n", (u_long)sp->st_wcount);
printf("%lu\tTotal log file flushes.\n", (u_long)sp->st_scount);
+ printf("%lu\tCurrent log file number.\n", (u_long)sp->st_cur_file);
+ printf("%lu\tCurrent log file offset.\n", (u_long)sp->st_cur_offset);
printf("%lu\tThe number of region locks granted without waiting.\n",
(u_long)sp->st_region_nowait);
printf("%lu\tThe number of region locks granted after waiting.\n",
(u_long)gsp->st_region_wait);
for (; fsp != NULL && *fsp != NULL; ++fsp) {
- printf("%s\n", DIVIDER);
+ printf("%s\n", DB_LINE);
printf("%s\n", (*fsp)->file_name);
printf("%lu\tPage size.\n", (u_long)(*fsp)->st_pagesize);
printf("%lu\tRequested pages found in the cache",
onint(signo)
int signo;
{
- signo = 1; /* XXX: Shut the compiler up. */
+ COMPQUIET(signo, 0);
+
interrupted = 1;
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)txn.c 10.37 (Sleepycat) 11/28/97";
+static const char sccsid[] = "@(#)txn.c 10.39 (Sleepycat) 1/8/98";
#endif /* not lint */
LOCK_TXNREGION(tmgrp);
if ((ret = __db_shalloc(tmgrp->mem, sizeof(db_mutex_t),
MUTEX_ALIGNMENT, &tmgrp->mutexp)) == 0)
- __db_mutex_init(tmgrp->mutexp, -1);
+ /*
+ * Since we only get here if threading is turned on, we
+ * know that we have spinlocks, so the offset is going
+ * to be ignored. We put 0 here as a valid placeholder.
+ */
+ __db_mutex_init(tmgrp->mutexp, 0);
UNLOCK_TXNREGION(tmgrp);
if (ret != 0)
goto out;
DB_TXNMGR *tp;
{
size_t incr;
- off_t mutex_offset;
- u_int32_t oldmax;
+ u_int32_t mutex_offset, oldmax;
u_int8_t *curaddr;
int ret;
/* Close a shared object opened by `_dl_open'.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
it are gone. */
for (i = 0; i < map->l_nsearchlist; ++i)
{
- struct link_map *map = list[i];
- if (map->l_opencount == 0 && map->l_type == lt_loaded)
+ struct link_map *imap = list[i];
+ if (imap->l_opencount == 0 && imap->l_type == lt_loaded)
{
/* That was the last reference, and this was a dlopen-loaded
object. We can unmap it. */
const ElfW(Phdr) *ph;
- if (map->l_info[DT_FINI])
+ if (imap->l_info[DT_FINI])
/* Call its termination function. */
- (*(void (*) (void)) ((void *) map->l_addr +
- map->l_info[DT_FINI]->d_un.d_ptr)) ();
+ (*(void (*) (void)) ((void *) imap->l_addr +
+ imap->l_info[DT_FINI]->d_un.d_ptr)) ();
- if (map->l_global)
+ if (imap->l_global)
{
/* This object is in the global scope list. Remove it. */
struct link_map **tail = _dl_global_scope_end;
do
--tail;
- while (*tail != map);
+ while (*tail != imap);
--_dl_global_scope_end;
memcpy (tail, tail + 1, _dl_global_scope_end - tail);
_dl_global_scope_end[0] = NULL;
}
/* Unmap the segments. */
- for (ph = map->l_phdr; ph < &map->l_phdr[map->l_phnum]; ++ph)
+ for (ph = imap->l_phdr + (imap->l_phnum - 1);
+ ph >= imap->l_phdr; --ph)
if (ph->p_type == PT_LOAD)
{
ElfW(Addr) mapstart = ph->p_vaddr & ~(ph->p_align - 1);
ElfW(Addr) mapend = ((ph->p_vaddr + ph->p_memsz
+ ph->p_align - 1)
& ~(ph->p_align - 1));
- __munmap ((caddr_t) mapstart, mapend - mapstart);
+ __munmap ((caddr_t) (imap->l_addr + mapstart),
+ mapend - mapstart);
}
/* Finally, unlink the data structure and free it. */
- if (map->l_prev)
- map->l_prev->l_next = map->l_next;
- if (map->l_next)
- map->l_next->l_prev = map->l_prev;
- if (map->l_searchlist)
- free (map->l_searchlist);
- free (map);
+ if (imap->l_prev)
+ imap->l_prev->l_next = imap->l_next;
+ if (imap->l_next)
+ imap->l_next->l_prev = imap->l_prev;
+ if (imap->l_searchlist)
+ free (imap->l_searchlist);
+ free (imap);
}
}
--- /dev/null
+/* Extended cpio format from POSIX.1.
+ This file is part of the GNU C Library.
+ Copyright (C) 1992, 1998 Free Software Foundation, Inc.
+
+ NOTE: The canonical source of this file is maintained with the GNU cpio.
+ Bugs can be reported to bug-glibc@gnu.org.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _CPIO_H
+#define _CPIO_H 1
+
+/* A cpio archive consists of a sequence of files.
+ Each file has a 76 byte header,
+ a variable length, NUL terminated filename,
+ and variable length file data.
+ A header for a filename "TRAILER!!!" indicates the end of the archive. */
+
+/* All the fields in the header are ISO 646 (approximately ASCII) strings
+ of octal numbers, left padded, not NUL terminated.
+
+ Field Name Length in Bytes Notes
+ c_magic 6 must be "070707"
+ c_dev 6
+ c_ino 6
+ c_mode 6 see below for value
+ c_uid 6
+ c_gid 6
+ c_nlink 6
+ c_rdev 6 only valid for chr and blk special files
+ c_mtime 11
+ c_namesize 6 count includes terminating NUL in pathname
+ c_filesize 11 must be 0 for FIFOs and directories */
+
+/* Value for the field `c_magic'. */
+#define MAGIC "070707"
+
+/* Values for c_mode, OR'd together: */
+
+#define C_IRUSR 000400
+#define C_IWUSR 000200
+#define C_IXUSR 000100
+#define C_IRGRP 000040
+#define C_IWGRP 000020
+#define C_IXGRP 000010
+#define C_IROTH 000004
+#define C_IWOTH 000002
+#define C_IXOTH 000001
+
+#define C_ISUID 004000
+#define C_ISGID 002000
+#define C_ISVTX 001000
+
+#define C_ISBLK 060000
+#define C_ISCHR 020000
+#define C_ISDIR 040000
+#define C_ISFIFO 010000
+#define C_ISSOCK 0140000
+#define C_ISLNK 0120000
+#define C_ISCTG 0110000
+#define C_ISREG 0100000
+
+#endif /* cpio.h */
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|| collate->kind == undefined);
/* Fill in the missing weights. */
- while (collate->weight_idx++ < collate->nrules)
+ while (++collate->weight_idx < collate->nrules)
{
collate->weight[collate->nweight++] = pelem->this_weight;
++collate->weight_cnt[collate->weight_idx];
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
check ("modf (-2.5, &x) returns -0.5", result, -0.5);
check ("modf (-2.5, &x) sets x to -2", intpart, -2);
+ result = FUNC(modf) (20, &intpart);
+ check ("modf (20, &x) returns 0", result, 0);
+ check ("modf (20, &x) sets x to 20", intpart, 20);
+
+ result = FUNC(modf) (21, &intpart);
+ check ("modf (21, &x) returns 0", result, 0);
+ check ("modf (21, &x) sets x to 21", intpart, 21);
}
#ifndef _SYS_SYSLOG_H
#define _SYS_SYSLOG_H 1
+#include <features.h>
+#define __need___va_list
+#include <stdarg.h>
+
+
#define _PATH_LOG "/dev/log"
/*
#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
#define LOG_PERROR 0x20 /* log to stderr as well */
-#define __need___va_list
-#include <stdarg.h>
-
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
/* Close desriptor used to write to system logger. */
/* Generate a log message using FMT string and option arguments. */
extern void syslog __P ((int __pri, __const char *__fmt, ...));
+#ifdef __USE_BSD
/* Generate a log message using FMT and using arguments pointed to by AP. */
extern void vsyslog __P ((int __pri, __const char *__fmt,
__gnuc_va_list __ap));
+#endif
__END_DECLS
--- /dev/null
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <rpcsvc/nis.h>
+#include "nis_intern.h"
+
+#include "nis_cache2.h"
+
+static struct timeval TIMEOUT = { 25, 0 };
+
+directory_obj *
+__nis_cache_search (const_nis_name name, u_long flags, cache2_info *cinfo)
+{
+ XDR xdrs;
+ CLIENT *clnt;
+ struct sockaddr_in clnt_saddr;
+ directory_obj *obj = NULL;
+ fs_result fsres;
+ int clnt_sock;
+
+ cinfo->server_used = -1;
+ cinfo->current_ep = -1;
+ cinfo->class = -1;
+
+ memset (&clnt_saddr, '\0', sizeof clnt_saddr);
+ clnt_saddr.sin_family = AF_INET;
+ clnt_saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ clnt_sock = RPC_ANYSOCK;
+ clnt = clnttcp_create (&clnt_saddr, CACHEPROG, CACHE_VER_1,
+ &clnt_sock, 0, 0);
+ if (clnt == NULL)
+ return NULL;
+
+ memset (&fsres, 0, sizeof (fsres));
+ if (flags & MASTER_ONLY)
+ {
+ if (clnt_call (clnt, NIS_CACHE_FIND_MASTER, (xdrproc_t) xdr_wrapstring,
+ (caddr_t) &name, (xdrproc_t) xdr_fs_result,
+ (caddr_t) &fsres, TIMEOUT) != RPC_SUCCESS)
+ {
+ clnt_destroy (clnt);
+ close (clnt_sock);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (clnt_call (clnt, NIS_CACHE_FIND_SERVER, (xdrproc_t) xdr_wrapstring,
+ (caddr_t) &name, (xdrproc_t) xdr_fs_result,
+ (caddr_t) &fsres, TIMEOUT) != RPC_SUCCESS)
+ {
+ clnt_destroy (clnt);
+ close (clnt_sock);
+ return NULL;
+ }
+ }
+
+ clnt_destroy (clnt);
+ close (clnt_sock);
+
+ if (fsres.status != NIS_SUCCESS)
+ return NULL;
+
+ obj = calloc (1, sizeof (directory_obj));
+ if (obj == NULL)
+ return NULL;
+
+ xdrmem_create (&xdrs, fsres.dir_data.dir_data_val,
+ fsres.dir_data.dir_data_len, XDR_DECODE);
+ xdr_directory_obj (&xdrs, obj);
+ xdr_destroy (&xdrs);
+
+ cinfo->server_used = fsres.server_used;
+ cinfo->current_ep = fsres.current_ep;
+ cinfo->class = fsres.class;
+
+ return obj;
+}
--- /dev/null
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _NIS_CACHE2_H_RPCGEN
+#define _NIS_CACHE2_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <rpcsvc/nis.h>
+
+struct fs_result {
+ nis_error status;
+ long class;
+ struct {
+ u_int dir_data_len;
+ char *dir_data_val;
+ } dir_data;
+ long server_used;
+ long current_ep;
+};
+typedef struct fs_result fs_result;
+#ifdef __cplusplus
+extern "C" bool_t xdr_fs_result(XDR *, fs_result*);
+#elif __STDC__
+extern bool_t xdr_fs_result(XDR *, fs_result*);
+#else /* Old Style C */
+bool_t xdr_fs_result();
+#endif /* Old Style C */
+
+
+struct fs_request {
+ nis_name name;
+ long old_class;
+};
+typedef struct fs_request fs_request;
+#ifdef __cplusplus
+extern "C" bool_t xdr_fs_request(XDR *, fs_request*);
+#elif __STDC__
+extern bool_t xdr_fs_request(XDR *, fs_request*);
+#else /* Old Style C */
+bool_t xdr_fs_request();
+#endif /* Old Style C */
+
+
+#define CACHEPROG ((u_long)600100301)
+#define CACHE_VER_1 ((u_long)1)
+
+#ifdef __cplusplus
+#define NIS_CACHE_READ_COLDSTART ((u_long)1)
+extern "C" void * nis_cache_read_coldstart_1(void *, CLIENT *);
+extern "C" void * nis_cache_read_coldstart_1_svc(void *, struct svc_req *);
+#define NIS_CACHE_FIND_MASTER ((u_long)2)
+extern "C" fs_result * nis_cache_find_master_1(char **, CLIENT *);
+extern "C" fs_result * nis_cache_find_master_1_svc(char **, struct svc_req *);
+#define NIS_CACHE_FIND_SERVER ((u_long)3)
+extern "C" fs_result * nis_cache_find_server_1(char **, CLIENT *);
+extern "C" fs_result * nis_cache_find_server_1_svc(char **, struct svc_req *);
+#define NIS_CACHE_NEXT_SERVER ((u_long)4)
+extern "C" fs_result * nis_cache_next_server_1(fs_request *, CLIENT *);
+extern "C" fs_result * nis_cache_next_server_1_svc(fs_request *, struct svc_req *);
+
+#elif __STDC__
+#define NIS_CACHE_READ_COLDSTART ((u_long)1)
+extern void * nis_cache_read_coldstart_1(void *, CLIENT *);
+extern void * nis_cache_read_coldstart_1_svc(void *, struct svc_req *);
+#define NIS_CACHE_FIND_MASTER ((u_long)2)
+extern fs_result * nis_cache_find_master_1(char **, CLIENT *);
+extern fs_result * nis_cache_find_master_1_svc(char **, struct svc_req *);
+#define NIS_CACHE_FIND_SERVER ((u_long)3)
+extern fs_result * nis_cache_find_server_1(char **, CLIENT *);
+extern fs_result * nis_cache_find_server_1_svc(char **, struct svc_req *);
+#define NIS_CACHE_NEXT_SERVER ((u_long)4)
+extern fs_result * nis_cache_next_server_1(fs_request *, CLIENT *);
+extern fs_result * nis_cache_next_server_1_svc(fs_request *, struct svc_req *);
+
+#else /* Old Style C */
+#define NIS_CACHE_READ_COLDSTART ((u_long)1)
+extern void * nis_cache_read_coldstart_1();
+extern void * nis_cache_read_coldstart_1_svc();
+#define NIS_CACHE_FIND_MASTER ((u_long)2)
+extern fs_result * nis_cache_find_master_1();
+extern fs_result * nis_cache_find_master_1_svc();
+#define NIS_CACHE_FIND_SERVER ((u_long)3)
+extern fs_result * nis_cache_find_server_1();
+extern fs_result * nis_cache_find_server_1_svc();
+#define NIS_CACHE_NEXT_SERVER ((u_long)4)
+extern fs_result * nis_cache_next_server_1();
+extern fs_result * nis_cache_next_server_1_svc();
+#endif /* Old Style C */
+
+#endif /* !_NIS_CACHE2_H_RPCGEN */
--- /dev/null
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+
+#include "nis_cache2.h"
+#include <rpcsvc/nis.h>
+
+bool_t
+xdr_fs_result(XDR *xdrs, fs_result *objp)
+{
+ if (!xdr_nis_error(xdrs, &objp->status)) {
+ return FALSE;
+ }
+ if (!xdr_long(xdrs, &objp->class)) {
+ return FALSE;
+ }
+ if (!xdr_bytes(xdrs, (char **)&objp->dir_data.dir_data_val, (u_int *)&objp->dir_data.dir_data_len, ~0)) {
+ return FALSE;
+ }
+ if (!xdr_long(xdrs, &objp->server_used)) {
+ return FALSE;
+ }
+ if (!xdr_long(xdrs, &objp->current_ep)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_fs_request(XDR *xdrs, fs_request *objp)
+{
+ if (!xdr_nis_name(xdrs, &objp->name)) {
+ return FALSE;
+ }
+ if (!xdr_long(xdrs, &objp->old_class)) {
+ return FALSE;
+ }
+ return TRUE;
+}
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
+ return NSS_STATUS_NOTFOUND;
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
- if (feof (ent->stream))
- return NSS_STATUS_NOTFOUND;
- else
- {
- fsetpos (ent->stream, &pos);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
}
/* Terminate the line for any case. */
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
return NSS_STATUS_NOTFOUND;
-
- /* Terminate the line for any case. */
- buffer[buflen - 1] = '\0';
+ if (p == NULL || buffer[buflen - 1] != '\xff')
+ {
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
+ }
/* Skip leading blanks. */
while (isspace (*p))
do
{
fgetpos (ent->stream, &pos);
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, ent->stream);
- if (p == NULL)
+ if (p == NULL && feof (ent->stream))
return NSS_STATUS_NOTFOUND;
-
- /* Terminate the line for any case. */
- buffer[buflen - 1] = '\0';
+ if (p == NULL || buffer[buflen - 1] != '\xff')
+ {
+ fsetpos (ent->stream, &pos);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
+ }
/* Skip leading blanks. */
while (isspace (*p))
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
ysd->dom_socket = -1;
ysd->dom_vers = -1;
}
- else
- ysd->dom_client = NULL;
try = 0;
/* Common code for file-based databases in nss_files module.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
do
{
/* Terminate the line so that we can test for overflow. */
- data->linebuffer[linebuflen - 1] = '\0';
+ data->linebuffer[linebuflen - 1] = '\xff';
p = fgets (data->linebuffer, linebuflen, stream);
if (p == NULL)
H_ERRNO_SET (HOST_NOT_FOUND);
return NSS_STATUS_NOTFOUND;
}
- else if (data->linebuffer[linebuflen - 1] != '\0')
+ else if (data->linebuffer[linebuflen - 1] != '\xff')
{
/* The line is too long. Give the user the opportunity to
enlarge the buffer. */
/* Read the first line. It must contain the alias name and
possibly some alias names. */
- first_unused[room_left - 1] = '\0';
+ first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, stream);
if (line == NULL)
/* Nothing to read. */
break;
- else if (first_unused[room_left - 1] != '\0')
+ else if (first_unused[room_left - 1] != '\xff')
{
/* The line is too long for our buffer. */
no_more_room:
{
while (! feof (listfile))
{
- first_unused[room_left - 1] = '\0';
+ first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, listfile);
if (line == NULL)
break;
- if (first_unused[room_left - 1] != '\0')
+ if (first_unused[room_left - 1] != '\xff')
{
free (old_line);
goto no_more_room;
/* The just read character is a white space and so
can be ignored. */
- first_unused[room_left - 1] = '\0';
+ first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, stream);
- if (first_unused[room_left - 1] != '\0')
+ if (first_unused[room_left - 1] != '\xff')
goto no_more_room;
cp = strpbrk (line, "#\n");
if (cp != NULL)
STRING_FIELD (addr, isspace, 1);
result->n_net = inet_network (addr);
+ result->n_addrtype = AF_INET;
})
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \
bits/local_lim.h tar.h bits/utsname.h bits/confname.h \
bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \
- bits/sched.h re_comp.h wait.h bits/environments.h
+ bits/sched.h re_comp.h wait.h bits/environments.h cpio.h
distribute := confstr.h TESTS TESTS2C.sed testcases.h \
globtest.c globtest.sh
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
/* Some forward declarations */
static int parse_dollars (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags,
- wordexp_t *pwordexp)
+ wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white)
internal_function;
static int parse_backtick (char **word, size_t *word_length,
size_t *max_length, const char *words,
- size_t *offset, int flags, wordexp_t *pwordexp)
+ size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white)
internal_function;
static int eval_expr (char *expr, int *result) internal_function;
internal_function
parse_glob (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags,
- wordexp_t *pwordexp, char *ifs)
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
{
/* We are poised just after a '*' or a '{'. */
int error;
case '$':
error = parse_dollars (word, word_length, max_length, words, offset,
- flags, pwordexp);
+ flags, pwordexp, ifs, ifs_white);
if (error)
return error;
{
case '$':
error = parse_dollars (&expr, &expr_length, &expr_maxlen,
- words, offset, flags, NULL);
- /* The NULL here is to tell parse_dollars not to
+ words, offset, flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_dollars not to
* split the fields.
*/
if (error)
case '`':
(*offset)++;
error = parse_backtick (&expr, &expr_length, &expr_maxlen,
- words, offset, flags, NULL);
- /* The NULL here is to tell parse_backtick not to
+ words, offset, flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_backtick not to
* split the fields.
*/
if (error)
static int
internal_function
exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
- int flags, wordexp_t *pwordexp)
+ int flags, wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white)
{
int fildes[2];
int bufsize = 128;
int buflen;
- int state = 0;
int i;
char *buffer;
pid_t pid;
- /* 'state' is:
- * 0 until first non-(whitespace-ifs)
- * 1 after a non-ifs
- * 2 after non-(whitespace-ifs)
- */
/* Don't fork() unless necessary */
if (!comm || !*comm)
close (fildes[0]);
return 0;
}
-
- /* Not quoted - split fields.
- * NB. This isn't done properly yet.
- */
- while (1)
+ else
+ /* Not quoted - split fields */
{
- if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
- {
- if (__waitpid (pid, NULL, WNOHANG) == 0)
- continue;
- if ((read (fildes[0], buffer, bufsize)) < 1)
- break;
- }
+ int copying = 0;
+ /* 'copying' is:
+ * 0 when searching for first character in a field not IFS white space
+ * 1 when copying the text of a field
+ * 2 when searching for possible non-whitespace IFS
+ */
- for (i = 0; i < buflen; ++i)
+ while (1)
{
- /* What if these aren't field separators? FIX */
- if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n')
+ if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
{
- if (state != 0)
- state = 2;
- continue;
+ if (__waitpid (pid, NULL, WNOHANG) == 0)
+ continue;
+ if ((read (fildes[0], buffer, bufsize)) < 1)
+ break;
}
- if (state == 2)
+ for (i = 0; i < buflen; ++i)
{
- /* End of word */
- if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
+ if (strchr (ifs, buffer[i]) != NULL)
{
- close (fildes[0]);
- return WRDE_NOSPACE;
- }
+ /* Current character is IFS */
+ if (strchr (ifs_white, buffer[i]) == NULL)
+ {
+ /* Current character is IFS but not whitespace */
+ if (copying == 2)
+ {
+ /* current character
+ * |
+ * V
+ * eg: text<space><comma><space>moretext
+ *
+ * So, strip whitespace IFS (like at the start)
+ */
+ copying = 0;
+ continue;
+ }
+
+ copying = 0;
+ /* fall through and delimit field.. */
+ }
+ else
+ {
+ /* Current character is IFS white space */
- *word = NULL;
- *word_length = 0;
- }
+ /* If not copying a field, ignore it */
+ if (copying != 1)
+ continue;
- state = 1;
- *word = w_addchar (*word, word_length, max_length, buffer[i]);
- if (*word == NULL)
- {
- close (fildes[0]);
- return WRDE_NOSPACE;
+ /* End of field (search for non-IFS afterwards) */
+ copying = 2;
+ }
+
+ /* First IFS white space, or IFS non-whitespace.
+ * Delimit the field. */
+ if (!*word)
+ {
+ /* This field is null, so make it an empty string */
+ *word = w_addchar (*word, word_length, max_length, 0);
+ if (*word == NULL)
+ {
+ close (fildes[0]);
+ return WRDE_NOSPACE;
+ }
+ }
+
+ if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
+ {
+ /* Should do __waitpid? */
+ close (fildes[0]);
+ return WRDE_NOSPACE;
+ }
+
+ *word = NULL;
+ *word_length = 0;
+ *max_length = 0;
+ /* fall back round the loop.. */
+ }
+ else
+ {
+ /* Not IFS character */
+ copying = 1;
+ *word = w_addchar (*word, word_length, max_length,
+ buffer[i]);
+ if (*word == NULL)
+ {
+ close (fildes[0]);
+ return WRDE_NOSPACE;
+ }
+ }
}
}
}
static int
parse_comm (char **word, size_t *word_length, size_t *max_length,
- const char *words, size_t *offset, int flags, wordexp_t *pwordexp)
+ const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white)
{
/* We are poised just after "$(" */
int paren_depth = 1;
{
/* Go -- give script to the shell */
error = exec_comm (comm, word, word_length, max_length, flags,
- pwordexp);
+ pwordexp, ifs, ifs_white);
free (comm);
return error;
}
static int
internal_function
parse_param (char **word, size_t *word_length, size_t *max_length,
- const char *words, size_t *offset, int flags, wordexp_t *pwordexp)
+ const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white)
{
/* We are poised just after "$" */
enum remove_pattern_enum
/* Quoted - no field split */
*word = w_addstr (*word, word_length, max_length, value);
else
- /* Should field-split here - FIX */
- *word = w_addstr (*word, word_length, max_length, value);
+ {
+ /* Need to field-split */
+ char *field_begin = value;
+ int seen_nonws_ifs = 0;
+
+ do
+ {
+ char *field_end = field_begin;
+ char *field;
+ char *next_field;
+ char ch;
+
+ /* Skip IFS whitespace before the field */
+ while (*field_begin && strchr (ifs_white, *field_begin) != NULL)
+ field_begin++;
+
+ if (!seen_nonws_ifs && *field_begin == 0)
+ /* Nothing but whitespace */
+ return 0;
+
+ /* Search for the end of the field */
+ field_end = field_begin;
+ while (*field_end && strchr (ifs, *field_end) == NULL)
+ field_end++;
+
+ /* Set up pointer to the character after end of field */
+ ch = *field_end;
+ next_field = ch ? field_end : NULL;
+
+ /* Skip whitespace IFS after the field */
+ while (next_field && *next_field && strchr (ifs_white, *next_field))
+ next_field++;
+
+ /* Skip at most one non-whitespace IFS character after the field */
+ seen_nonws_ifs = 0;
+ if (next_field && *next_field && strchr (ifs, *next_field))
+ {
+ seen_nonws_ifs = 1;
+ next_field++;
+ }
+
+ /* Null-terminate it and make a copy */
+ *field_end = 0;
+ field = __strdup (field_begin);
+ if (field == NULL)
+ goto no_space;
+
+ /* Tag the field onto the word list */
+ if (w_addword (pwordexp, field) == WRDE_NOSPACE)
+ return WRDE_NOSPACE;
+
+ *word = NULL;
+ *word_length = *max_length = 0;
+
+ field_begin = next_field;
+ } while (seen_nonws_ifs || (field_begin && *field_begin));
+
+ return 0;
+ }
return *word ? 0 : WRDE_NOSPACE;
internal_function
parse_dollars (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags,
- wordexp_t *pwordexp)
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
{
/* We are poised _at_ "$" */
switch (words[1 + *offset])
(*offset) += 2;
return parse_comm (word, word_length, max_length, words, offset, flags,
- pwordexp);
+ pwordexp, ifs, ifs_white);
case '[':
(*offset) += 2;
default:
++(*offset); /* parse_param needs to know if "{" is there */
return parse_param (word, word_length, max_length, words, offset, flags,
- pwordexp);
+ pwordexp, ifs, ifs_white);
}
}
static int
parse_backtick (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags,
- wordexp_t *pwordexp)
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
{
/* We are poised just after "`" */
int error;
case '`':
/* Go -- give the script to the shell */
error = exec_comm (comm, word, word_length, max_length, flags,
- pwordexp);
+ pwordexp, ifs, ifs_white);
free (comm);
return error;
case '$':
error = parse_dollars (word, word_length, max_length, words, offset,
- flags, NULL);
- /* The NULL here is to tell parse_dollars not to
+ flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_dollars not to
* split the fields.
*/
if (error)
++(*offset);
error = parse_backtick (word, word_length, max_length, words,
- offset, flags, NULL);
- /* The NULL here is to tell parse_backtick not to
+ offset, flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_backtick not to
* split the fields.
*/
if (error)
ifs = getenv ("IFS");
if (!ifs)
- ifs = strcpy (ifs_white, " \t\n");
+ /* NULL IFS means no field-splitting is to be performed */
+ ifs = strcpy (ifs_white, "");
else
{
char *ifsch = ifs;
char *whch = ifs_white;
+ /* Start off with no whitespace IFS characters */
+ ifs_white[0] = '\0';
+
while (*ifsch != '\0')
- if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
- {
- /* White space IFS. See first whether it is already in our
- collection. */
- char *runp = ifs_white;
+ {
+ if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
+ {
+ /* Whitespace IFS. See first whether it is already in our
+ collection. */
+ char *runp = ifs_white;
- while (runp < whch && *runp != '\0' && *runp != *ifsch)
- ++runp;
+ while (runp < whch && *runp != '\0' && *runp != *ifsch)
+ ++runp;
- if (runp == whch)
- *whch++ = *ifsch;
- }
+ if (runp == whch)
+ *whch++ = *ifsch;
+ }
+
+ ifsch++;
+ }
*whch = '\0';
}
case '$':
error = parse_dollars (&word, &word_length, &max_length, words,
- &words_offset, flags, pwordexp);
+ &words_offset, flags, pwordexp, ifs, ifs_white);
if (error)
goto do_error;
++words_offset;
error = parse_backtick (&word, &word_length, &max_length, words,
- &words_offset, flags, pwordexp);
+ &words_offset, flags, pwordexp, ifs,
+ ifs_white);
if (error)
goto do_error;
case '*':
case '{':
error = parse_glob (&word, &word_length, &max_length, words,
- &words_offset, flags, pwordexp, ifs);
+ &words_offset, flags, pwordexp, ifs, ifs_white);
if (error)
goto do_error;
word = NULL;
word_length = 0;
+ max_length = 0;
break;
}
-/* Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
/* Get the system-dependent definitions of structures and bit values. */
#include <bits/resource.h>
-/* Get the definitions for the `ulimit' function. */
-#include <ulimit.h>
-
__BEGIN_DECLS
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
do
{
+ buffer[buflen] = '\xff';
p = fgets (buffer, buflen, stream);
- if (p == NULL)
+ if (p == NULL && feof (stream))
{
*result = NULL;
return errno;
}
+ if (p == NULL || buffer[buflen] != '\xff')
+ {
+ *result = NULL;
+ return errno = ERANGE;
+ }
/* Skip leading blanks. */
while (isspace (*p))
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
sigreturn \
siggetmask sysv_signal \
sigisempty sigandset sigorset \
- allocrtsig sigtimedwait sigwaitinfo sigqueue
+ allocrtsig sigtimedwait sigwaitinfo sigqueue \
+ sighold sigrelse sigignore sigset
tests := tst-signal
--- /dev/null
+/* Add SIG to the calling process' signal mask.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <signal.h>
+
+int
+sighold (sig)
+ int sig;
+{
+ sigset_t set;
+
+ /* Retrieve current signal set. */
+ if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+ return -1;
+
+ /* Add the specified signal. */
+ if (sigaddset (&set, sig) < 0)
+ return -1;
+
+ /* Set the new mask. */
+ return __sigprocmask (SIG_SETMASK, &set, NULL);
+}
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#endif /* signal.h included and use BSD or X/Open Unix. */
+#if defined _SIGNAL_H && defined __USE_UNIX98
+/* Simplified interface for signal management. */
+
+/* Add SIG to the calling process' signal mask. */
+extern int sighold __P ((int __sig));
+
+/* Remove SIG from the calling process' signal mask. */
+extern int sigrelse __P ((int __sig));
+
+/* Set the disposition of SIG to SIG_IGN. */
+extern int sigignore __P ((int __sig));
+
+/* Set the disposition of SIG. */
+extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
+#endif
+
+
/* The following functions are used internally in the C library and in
other code which need deep insights. */
--- /dev/null
+/* Remove SIG from the calling process' signal mask.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <signal.h>
+
+int
+sigrelse (sig)
+ int sig;
+{
+ sigset_t set;
+
+ /* Retrieve current signal set. */
+ if (sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+ return -1;
+
+ /* Remove the specified signal. */
+ if (sigdelset (&set, sig) < 0)
+ return -1;
+
+ /* Set the new mask. */
+ return sigprocmask (SIG_SETMASK, &set, NULL);
+}
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
system canonicalize \
a64l l64a \
rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
- strtoimax strtoumax wcstoimax wcstoumax
+ strtoimax strtoumax wcstoimax wcstoumax \
+ getcontext setcontext makecontext swapcontext
distribute := exit.h grouping.h abort-instr.h
tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
extern int getcontext __P ((ucontext_t *__ucp));
/* Set user context from information of variable pointed to by UCP. */
-extern int setcontext __P ((ucontext_t *__ucp));
+extern int setcontext __P ((__const ucontext_t *__ucp));
/* Save current context in context variable pointed to by OUCP and set
context from variable pointed to by UCP. */
-extern int swapcontext __P ((ucontext_t *__oucp, ucontext_t *__ucp));
+extern int swapcontext __P ((ucontext_t *__oucp, __const ucontext_t *__ucp));
/* Manipulate user context UCP to continue with calling functions FUNC
and the ARGC-1 parameters following ARGC when the context is used
We cannot say anything about the parameters FUNC takes; `void'
is as good as any other choice. */
-extern void makecontext __P ((ucontext_t *__ucp, void (*__func) __P ((void)),
+extern void makecontext __P ((ucontext_t *__ucp, void (*__func) (void),
int __argc, ...));
__END_DECLS
--- /dev/null
+# Copyright (C) 1998 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If
+# not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#
+# Makefile for streams.
+#
+subdir := streams
+
+headers = stropts.h bits/stropts.h
+routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
+
+include ../Rules
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _STROPTS_H
+#define _STROPTS_H 1
+
+#include <features.h>
+#include <bits/types.h>
+
+/* Get system specific contants. */
+#include <bits/stropts.h>
+
+
+__BEGIN_DECLS
+
+/* Test whether FILDES is associated with a STREAM-based file. */
+extern int isastream __P ((int __fildes));
+
+/* Receive next message from a STREAMS file. */
+extern int getmsg __P ((int __fildes, struct strbuf *__ctlptr,
+ struct strbuf *__dataptr, int *__flagsp));
+
+/* Receive next message from a STREAMS file, with *FLAGSP allowing to
+ control which message. */
+extern int getpmsg __P ((int __fildes, struct strbuf *__ctlptr,
+ struct strbuf *__dataptr, int *__bandp,
+ int *__flagsp));
+
+/* Perform the I/O control operation specified by REQUEST on FD.
+ One argument may follow; its presence and type depend on REQUEST.
+ Return value depends on REQUEST. Usually -1 indicates error. */
+extern int ioctl __P ((int __fd, unsigned long int __request, ...));
+
+/* Send a message on a STREAM. */
+extern int putmsg __P ((int __fildes, __const struct strbuf *__ctlptr,
+ __const struct strbuf *__dataptr, int __flags));
+
+/* Send a message on a STREAM to the BAND. */
+extern int putpmsg __P ((int __fildes, __const struct strbuf *__ctlptr,
+ __const struct strbuf *__dataptr, int __band,
+ int __flags));
+
+/* Attach a STREAMS-based file descriptor FILDES to a file PATH in the
+ file system name space. */
+extern int fattach __P ((int __fildes, __const char *__path));
+
+/* Detach a name PATH from a STREAMS-based file descriptor. */
+extern int fdetach __P ((__const char *__path));
+
+__END_DECLS
+
+#endif /* stropts.h */
-/* Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 96, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
extern char *_strerror_internal __P ((int, char *, size_t));
-/* Return a string describing the errno code in ERRNUM. At most BUFLEN
- characters of the result will be placed in STRERRBUF. */
+/* Return a string describing the errno code in ERRNUM. If a temporary
+ buffer is required, at most BUFLEN bytes of BUF will be used. */
char *
__strerror_r (int errnum, char *buf, size_t buflen)
{
/* Machine-dependent ELF dynamic relocation inline functions. Alpha version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
#else
#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb); \
- strong_alias (_dl_runtime_resolve, _dl_runtime_profile, #nop);
+ extern void _dl_runtime_resolve (void); \
+ extern void _dl_runtime_profile (void); \
+ strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
#endif
/* Initial entry point code for the dynamic linker.
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _BITS_STROPTS_H
+#define _BITS_STROPTS_H 1
+
+#include <bits/types.h>
+
+/* Macros used as `request' argument to `ioctl'. */
+#define I_PUSH 1 /* Push STREAMS module onto top of the current
+ STREAM, just below the STREAM head. */
+#define I_POP 2 /* Remove STREAMS module from just below the
+ STREAM head. */
+#define I_LOOK 3 /* Retrieve the name of the module just below
+ the STREAM head and place it in a character
+ string. */
+#define I_FLUSH 4 /* Flush all input and/or output. */
+#define I_FLUSHBAND 5 /* Flush only band specified. */
+#define I_SETSIG 6 /* Inform the STREAM head that the process
+ wants the SIGPOLL signal issued. */
+#define I_GETSIG 7 /* Return the events for which the calling
+ process is currently registered to be sent
+ a SIGPOLL signal. */
+#define I_FIND 8 /* Compares the names of all modules currently
+ present in the STREAM to the name pointed to
+ by `arg'. */
+#define I_PEEK 9 /* Allows a process to retrieve the information
+ in the first message on the STREAM head read
+ queue without taking the message off the
+ queue. */
+#define I_SRDOPT 10 /* Sets the read mode. */
+#define I_GRDOPT 11 /* Returns the current read mode setting. */
+#define I_NREAD 12 /* Counts the number of data bytes in the data
+ block in the first message. */
+#define I_FDINSERT 13 /* Create a message from the specified
+ buffer(s), adds information about another
+ STREAM, and send the message downstream. */
+#define I_STR 14 /* Construct an internal STREAMS `ioctl'
+ message and send that message downstream. */
+#define I_SWROPT 15 /* Set the write mode. */
+#define I_GWRSET 16 /* Return the current write mode setting. */
+#define I_SENDFD 17 /* Requests the STREAM associated with `fildes'
+ to send a message, containing a file
+ pointer, to the STREAM head at the other end
+ of a STREAMS pipe. */
+#define I_RECVFD 18 /* Retrieve the file descriptor associated with
+ the message sent by an I_SENDFD `ioctl'
+ over a STREAMS pipe. */
+#define I_LIST 19 /* List all the module names on the STREAM, up
+ to and including the topmost driver name. */
+#define I_ATMARK 20 /* See if the current message on the STREAM
+ head read queue is "marked" by some module
+ downstream. */
+#define I_CKBAND 21 /* Check if the message of a given priority
+ band exists on the STREAM head read
+ queue. */
+#define I_GETBAND 22 /* Return the priority band of the first
+ message on the STREAM head read queue. */
+#define I_CANPUT 23 /* Check if a certain band is writable. */
+#define I_SETCLTIME 24 /* Set the time the STREAM head will delay when
+ a STREAM is closing and there is data on
+ the write queues. */
+#define I_LINK 25 /* Connect two STREAMs. */
+#define I_UNLINK 26 /* Disconnects the two STREAMs. */
+#define I_PLINK 27 /* Connect two STREAMs with a persistent
+ link. */
+#define I_PUNLINK 28 /* Disconnect the two STREAMs that were
+ connected with a persistent link. */
+
+
+/* Used in `I_LOOK' request. */
+#define FMNAMESZ 255
+
+/* Flush options. */
+#define FLUSHR 1 /* Flush read queues. */
+#define FLUSHW 2 /* Flush write queues. */
+#define FLUSHRW 3 /* Flush read and write queues. */
+
+/* Possible arguments for `I_SETSIG'. */
+#define S_RDNORM 0x0001 /* A normal message has arrived. */
+#define S_RDBAND 0x0002 /* A message with a non-zero priority has
+ arrived. */
+#define S_INPUT 0x0004 /* A message, other than a high-priority
+ message, has arrived. */
+#define S_HIPRI 0x0008 /* A high-priority message is present. */
+#define S_OUTPUT 0x0010 /* The write queue for normal data is no longer
+ full. */
+#define S_WRNORM S_OUTPUT
+#define S_WRBAND 0x0020 /* The write queue for a non-zero priority
+ band is no longer full. */
+#define S_MSG 0x0040 /* A STREAMS signal message that contains the
+ SIGPOLL signal reaches the front of the
+ STREAM head read queue. */
+#define S_ERROR 0x0080 /* Notification of an error condition. */
+#define S_HANGUP 0x0100 /* Notification of a hangup. */
+#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
+ SIGURG is generated instead of SIGPOLL when
+ a priority message reaches the front of the
+ STREAM head read queue. */
+
+/* Option for `I_PEEK'. */
+#define RS_HIPRI 1 /* Only look for high-priority messages. */
+
+/* Options for `I_SRDOPT'. */
+#define RDNORM 1 /* Byte-STREAM mode, the default. */
+#define RMSGD 2 /* Message-discard mode. */
+#define RMSGN 3 /* Message-nondiscard mode. */
+#define RPROTNORM 4 /* Fail `read' with EBADMSG if a message
+ containing a control part is at the front
+ of the STREAM head read queue. */
+#define RPROTDAT 5 /* Deliver the control part of a message as
+ data. */
+#define RPROTDIS 6 /* Discard the control part of a message,
+ delivering any data part. */
+
+/* Possible mode for `I_SWROPT'. */
+#define SNDZERO 1 /* Send a zero-length message downstream when a
+ `write' of 0 bytes occurs. */
+
+/* Arguments for `I_ATMARK'. */
+#define ANYMARK 1 /* Check if the message is marked. */
+#define LASTMARK 2 /* Check if the message is the last one marked
+ on the queue. */
+
+/* Argument for `I_UNLINK'. */
+#define MUXID_ALL 1 /* Unlink all STREAMs linked to the STREAM
+ associated with `fildes'. */
+
+
+/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
+#define MSG_ANY 1 /* Receive any message. */
+#define MSG_BAND 2 /* Receive message from specified band. */
+#define MSG_HIPRI 3 /* Send/receive high priority message. */
+#define MORECTL 4 /* More control information is left in
+ message. */
+#define MOREDATA 5 /* More data is left in message. */
+
+
+/* Structure used for the I_FLUSHBAND ioctl on streams. */
+struct bandinfo
+ {
+ unsigned char bi_pri;
+ int bi_flag;
+ };
+
+struct strbuf
+ {
+ int maxlen; /* Maximum buffer length. */
+ int len; /* Length of data. */
+ char *buf; /* Pointer to buffer. */
+ };
+
+struct strpeek
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ __t_uscalar_t flags;
+ };
+
+struct strfdinsert
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ __t_uscalar_t flags;
+ int fildes;
+ int offset;
+ };
+
+struct strioctl
+ {
+ int ic_cmd;
+ int ic_timout;
+ int ic_len;
+ char *ic_dp;
+ };
+
+struct strrecvfd
+ {
+ int fd;
+ __uid_t uid;
+ __gid_t gid;
+ };
+
+
+struct str_mlist
+ {
+ char l_name[FMNAMESZ + 1];
+ };
+
+struct str_list
+ {
+ int sl_nmods;
+ struct str_mlist *sl_modlist;
+ };
+
+#endif /* bits/stropts.h */
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
typedef unsigned long int __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+fattach (fildes, path)
+ int fildes;
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fattach)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+fdetach (path)
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fdetach)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+getcontext (ucp)
+ ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getcontext)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+getmsg (fildes, ctlptr, dataptr, flagsp)
+ int fildes;
+ struct strbuf *ctlptr;
+ struct strbuf *dataptr;
+ int *flagsp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getmsg)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+getpmsg (fildes, ctlptr, dataptr, bandp, flagsp)
+ int fildes;
+ struct strbuf *ctlptr;
+ struct strbuf *dataptr;
+ int *bandp;
+ int *flagsp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getpmsg)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+isastream (fildes)
+ int fildes;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (isastream)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+void
+makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ __set_errno (ENOSYS);
+}
+
+
+stub_warning (makecontext)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+putmsg (fildes, ctlptr, dataptr, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (putmsg)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+putpmsg (fildes, ctlptr, dataptr, band, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int band;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (putpmsg)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+setcontext (ucp)
+ const ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (setcontext)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG to SIG_IGN. */
+int
+sigignore (sig)
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigignore)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG. */
+__sighandler_t
+sigset (sig, disp)
+ int sig;
+ __sighandler_t disp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigset)
+#include <stub-tag.h>
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+swapcontext (oucp, ucp)
+ ucontext_t *oucp;
+ const ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (swapcontext)
+#include <stub-tag.h>
SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */
return x;
} else {
- i = (0xffffffff)>>j0;
+ i = (0x7fffffff)>>j0;
if(((i0&i)|i1)==0) { /* x is integral */
*iptr = x;
SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */
SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */
return x;
} else { /* fraction part in low x */
- i = ((u_int32_t)(0xffffffff))>>(j0-20);
+ i = ((u_int32_t)(0x7fffffff))>>(j0-32);
if((i1&i)==0) { /* x is integral */
*iptr = x;
INSERT_WORDS(x,se&0x8000,0); /* return +-0 */
-/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <string.h>
#include <mach/error.h>
#include <errorlib.h>
-#include "../stdio-common/_itoa.h"
+#include <sys/param.h>
+#include <stdio-common/_itoa.h>
/* It is critical here that we always use the `dcgettext' function for
the message translation. Since <libintl.h> only defines the macro
if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
{
+ /* Buffer we use to print the number in. For a maximum size for
+ `int' of 8 bytes we never need more than 20 digits. */
+ char numbuf[21];
const char *unk = _("Error in unknown error system: ");
const size_t unklen = strlen (unk);
- char *p = buf + buflen;
- *--p = '\0';
- p = _itoa (errnum, p, 16, 1);
- return memcpy (p - unklen, unk, unklen);
+ char *p, *q;
+
+ numbuf[20] = '\0';
+ p = _itoa_word (errnum, &numbuf[20], 16, 1);
+
+ /* Now construct the result while taking care for the destination
+ buffer size. */
+ q = __mempcpy (buf, unk, MIN (unklen, buflen));
+ if (unklen < buflen)
+ __stpncpy (q, p, buflen - unklen);
+
+ /* Terminate the string in any case. */
+ if (buflen > 0)
+ buf[buflen - 1] = '\0';
+
+ return buf;
}
es = &__mach_error_systems[system];
if (code >= es->subsystem[sub].max_code)
{
+ /* Buffer we use to print the number in. For a maximum size for
+ `int' of 8 bytes we never need more than 20 digits. */
+ char numbuf[21];
const char *unk = _("Unknown error ");
const size_t unklen = strlen (unk);
- char *p = buf + buflen;
+ char *p, *q;
size_t len = strlen (es->subsystem[sub].subsys_name);
- *--p = '\0';
- p = _itoa (errnum, p, 16, 1);
- *p-- = ' ';
- p = memcpy (p - len, es->subsystem[sub].subsys_name, len);
- return memcpy (p - unklen, unk, unklen);
+
+ numbuf[20] = '\0';
+ p = _itoa_word (errnum, &numbuf[20], 10, 0);
+
+ /* Now construct the result while taking care for the destination
+ buffer size. */
+ q = __mempcpy (buf, unk, MIN (unklen, buflen));
+ if (unklen < buflen)
+ {
+ q = __mempcpy (q, es->subsystem[sub].subsys_name,
+ MIN (len, buflen - unklen));
+ if (unklen + len < buflen)
+ {
+ *q++ = ' ';
+ if (unklen + len + 1 < buflen)
+ __stpncpy (q, p, buflen - unklen - len - 1);
+ }
+ }
+
+ /* Terminate the string in any case. */
+ if (buflen > 0)
+ buf[buflen - 1] = '\0';
+
+ return buf;
}
return (char *) _(es->subsystem[sub].codes[code]);
--- /dev/null
+/* Set the disposition of SIG to SIG_IGN.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+sigignore (sig)
+ int sig;
+{
+ struct sigaction act;
+
+ act.sa_handler = SIG_IGN;
+ if (__sigemptyset (&act.sa_mask) < 0)
+ return -1;
+ act.sa_flags = 0;
+
+ return __sigaction (sig, &act, NULL);
+}
--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG. */
+__sighandler_t
+sigset (sig, disp)
+ int sig;
+ __sighandler_t disp;
+{
+ struct sigaction act, oact;
+
+ /* Handle SIG_HOLD first. */
+ if (disp == SIG_HOLD)
+ {
+ sigset_t set;
+
+ /* Retrieve current signal set. */
+ if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+ return SIG_ERR;
+
+ /* Add the specified signal. */
+ if (sigaddset (&set, sig) < 0)
+ return SIG_ERR;
+
+ /* Set the new mask. */
+ if (__sigprocmask (SIG_SETMASK, &set, NULL) < 0)
+ return SIG_ERR;
+
+ return SIG_HOLD;
+ }
+
+ /* Check signal extents to protect __sigismember. */
+ if (disp == SIG_ERR || sig < 1 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return SIG_ERR;
+ }
+
+ act.sa_handler = disp;
+ if (__sigemptyset (&act.sa_mask) < 0)
+ return SIG_ERR;
+ act.sa_flags = 0;
+ if (__sigaction (sig, &act, &oact) < 0)
+ return SIG_ERR;
+
+ return oact.sa_handler;
+}
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
char *__ttyname = NULL;
-/* Return the pathname of the terminal FD is open on, or NULL on errors.
- The returned storage is good only until the next call to this function. */
-char *
-ttyname (fd)
+static char * getttyname __P ((int fd, dev_t mydev, ino_t myino,
+ int save, int *dostat)) internal_function;
+
+static char *
+internal_function
+getttyname (fd, mydev, myino, save, dostat)
int fd;
+ dev_t mydev;
+ ino_t myino;
+ int save;
+ int *dostat;
{
static const char dev[] = "/dev";
static char *name;
static size_t namelen = 0;
struct stat st;
- dev_t mydev;
- ino_t myino;
DIR *dirstream;
struct dirent *d;
- int save = errno;
-
- if (!__isatty (fd))
- return NULL;
-
- if (fstat (fd, &st) < 0)
- return NULL;
- mydev = st.st_dev;
- myino = st.st_ino;
dirstream = opendir (dev);
if (dirstream == NULL)
- return NULL;
+ {
+ *dostat = -1;
+ return NULL;
+ }
while ((d = readdir (dirstream)) != NULL)
- if ((ino_t) d->d_fileno == myino)
+ if ((ino_t) d->d_fileno == myino || *dostat)
{
size_t dlen = _D_ALLOC_NAMLEN (d);
if (sizeof (dev) + dlen > namelen)
name = malloc (namelen);
if (! name)
{
+ *dostat = -1;
/* Perhaps it helps to free the directory stream buffer. */
(void) closedir (dirstream);
return NULL;
*((char *) __mempcpy (name, dev, sizeof (dev) - 1)) = '/';
}
(void) __mempcpy (&name[sizeof (dev)], d->d_name, dlen);
- if (stat (name, &st) == 0 && st.st_dev == mydev)
+ if (stat (name, &st) == 0
+#ifdef _STATBUF_ST_RDEV
+ && S_ISCHR (st.st_mode) && st.st_rdev == mydev
+#else
+ && (ino_t) d->d_fileno == myino && st.st_dev == mydev
+#endif
+ )
{
(void) closedir (dirstream);
__ttyname = name;
__set_errno (save);
return NULL;
}
+
+/* Return the pathname of the terminal FD is open on, or NULL on errors.
+ The returned storage is good only until the next call to this function. */
+char *
+ttyname (fd)
+ int fd;
+{
+ struct stat st;
+ int dostat = 0;
+ char *name;
+ int save = errno;
+
+ if (!__isatty (fd))
+ return NULL;
+
+ if (fstat (fd, &st) < 0)
+ return NULL;
+
+#ifdef _STATBUF_ST_RDEV
+ name = getttyname (fd, st.st_rdev, st.st_ino, save, &dostat);
+#else
+ name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat);
+#endif
+
+ if (!name && dostat != -1)
+ {
+ dostat = 1;
+#ifdef _STATBUF_ST_RDEV
+ name = getttyname (fd, st.st_rdev, st.st_ino, save, &dostat);
+#else
+ name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat);
+#endif
+ }
+
+ return name;
+}
-/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
-/* Store at most BUFLEN character of the pathname of the terminal FD is
- open on in BUF. Return 0 on success, otherwise an error number. */
-int
-__ttyname_r (fd, buf, buflen)
+static const char dev[] = "/dev";
+
+static int getttyname_r __P ((int fd, char *buf, size_t buflen,
+ dev_t mydev, ino_t myino, int save,
+ int *dostat)) internal_function;
+
+static int
+internal_function
+getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
int fd;
char *buf;
size_t buflen;
+ dev_t mydev;
+ ino_t myino;
+ int save;
+ int *dostat;
{
- static const char dev[] = "/dev";
struct stat st;
- dev_t mydev;
- ino_t myino;
DIR *dirstream;
struct dirent *d;
- int save = errno;
-
- /* Test for the absolute minimal size. This makes life easier inside
- the loop. */
- if (buflen < (int) (sizeof (dev) + 1))
- {
- __set_errno (ERANGE);
- return ERANGE;
- }
-
- if (!__isatty (fd))
- {
- __set_errno (ENOTTY);
- return ENOTTY;
- }
-
- if (fstat (fd, &st) < 0)
- return errno;
- mydev = st.st_dev;
- myino = st.st_ino;
dirstream = opendir (dev);
if (dirstream == NULL)
- return errno;
-
- /* Prepare the result buffer. */
- memcpy (buf, dev, sizeof (dev) - 1);
- buf[sizeof (dev) - 1] = '/';
- buflen -= sizeof (dev);
+ {
+ *dostat = -1;
+ return errno;
+ }
while ((d = readdir (dirstream)) != NULL)
- if ((ino_t) d->d_fileno == myino)
+ if ((ino_t) d->d_fileno == myino || *dostat)
{
char *cp;
size_t needed = _D_EXACT_NAMLEN (d) + 1;
if (needed > buflen)
{
+ *dostat = -1;
(void) closedir (dirstream);
__set_errno (ERANGE);
return ERANGE;
cp = __stpncpy (&buf[sizeof (dev)], d->d_name, needed);
cp[0] = '\0';
- if (stat (buf, &st) == 0 && st.st_dev == mydev)
+ if (stat (buf, &st) == 0
+#ifdef _STATBUF_ST_RDEV
+ && S_ISCHR (st.st_mode) && st.st_rdev == mydev
+#else
+ && (ino_t) d->d_fileno == myino && st.st_dev == mydev
+#endif
+ )
{
(void) closedir (dirstream);
__set_errno (save);
refers to a TTY but no entry in /dev has this inode. */
return ENOTTY;
}
+
+/* Store at most BUFLEN character of the pathname of the terminal FD is
+ open on in BUF. Return 0 on success, otherwise an error number. */
+int
+__ttyname_r (fd, buf, buflen)
+ int fd;
+ char *buf;
+ size_t buflen;
+{
+ struct stat st;
+ int dostat = 0;
+ int save = errno;
+ int ret;
+
+ /* Test for the absolute minimal size. This makes life easier inside
+ the loop. */
+ if (!buf)
+ {
+ __set_errno (EINVAL);
+ return EINVAL;
+ }
+
+ if (buflen < (int) (sizeof (dev) + 1))
+ {
+ __set_errno (ERANGE);
+ return ERANGE;
+ }
+
+ if (!__isatty (fd))
+ {
+ __set_errno (ENOTTY);
+ return ENOTTY;
+ }
+
+ if (fstat (fd, &st) < 0)
+ return errno;
+
+ /* Prepare the result buffer. */
+ memcpy (buf, dev, sizeof (dev) - 1);
+ buf[sizeof (dev) - 1] = '/';
+ buflen -= sizeof (dev);
+
+#ifdef _STATBUF_ST_RDEV
+ ret = getttyname_r (fd, buf, buflen, st.st_rdev, st.st_ino, save,
+ &dostat);
+#else
+ ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino, save,
+ &dostat);
+#endif
+
+ if (ret && dostat != -1)
+ {
+ dostat = 1;
+#ifdef _STATBUF_ST_RDEV
+ ret = getttyname_r (fd, buf, buflen, st.st_rdev, st.st_ino,
+ save, &dostat);
+#else
+ ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino,
+ save, &dostat);
+#endif
+ }
+
+ return ret;
+}
+
weak_alias (__ttyname_r, ttyname_r)
hesiod
sunrpc
nis
+streams
/* Signal number definitions. Linux/Alpha version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
/*
* Linux/AXP has different signal numbers that Linux/i386: I'm trying
* to make it OSF/1 binary compatible, at least for normal binaries.
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
};
#endif
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
/* Encoding of the file mode. */
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
} __fd_set;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
/* Signal number definitions. Linux version.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
/* Signals. */
#define SIGHUP 1 /* Hangup (POSIX). */
-/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
};
#endif
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
/* Encoding of the file mode. */
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
/* Type of file sizes and offsets. */
typedef __loff_t __off64_t;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
stack_t uc_stack;
mcontext_t uc_mcontext;
__sigset_t uc_sigmask;
+ struct _fpstate __fpregs_mem;
} ucontext_t;
#endif /* sys/ucontext.h */
/* Signal number definitions. Linux version.
- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#define __need_signums
#include <asm/signal.h>
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
#endif /* <signal.h> included. */
#define __need__nsig
-/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
};
#endif
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
/* Encoding of the file mode. */
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
/* Type of file sizes and offsets. */
typedef __loff_t __off64_t;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
/* Signal number definitions. Linux/SPARC version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
/*
* Linux/SPARC has different signal numbers that Linux/i386: I'm trying
* to make it OSF/1 binary compatible, at least for normal binaries.
+++ /dev/null
-ifeq ($(subdir),misc)
-sysdep_headers += ucontext.h
-sysdep_routines += getcontext setcontext
-endif
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
typedef unsigned long int __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
+/* Used in XTI. */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
#endif /* bits/types.h */
/* Definitions for POSIX-style memory management. Linux version.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
be memory resident. */
-extern int mlock __P ((__ptr_t __addr, size_t __len));
+extern int mlock __P ((__const __ptr_t __addr, size_t __len));
/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */
-extern int munlock __P ((__ptr_t __addr, size_t __len));
+extern int munlock __P ((__const __ptr_t __addr, size_t __len));
#ifdef __USE_MISC
/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <errno.h>
#include <stdarg.h>
#include <sysdep.h>
+#include <ulimit.h>
#include <unistd.h>
#include <sys/resource.h>