aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog155
-rw-r--r--Makeconfig6
-rw-r--r--Makefile4
-rw-r--r--config.make.in2
-rwxr-xr-xconfigure13
-rw-r--r--configure.in11
-rw-r--r--db/btree/bt_page.c2
-rw-r--r--db2/Makefile4
-rw-r--r--db2/btree/bt_close.c10
-rw-r--r--db2/btree/bt_compare.c6
-rw-r--r--db2/btree/bt_conv.c18
-rw-r--r--db2/btree/bt_cursor.c26
-rw-r--r--db2/btree/bt_delete.c17
-rw-r--r--db2/btree/bt_put.c32
-rw-r--r--db2/btree/bt_rec.c8
-rw-r--r--db2/btree/bt_recno.c6
-rw-r--r--db2/btree/bt_search.c8
-rw-r--r--db2/btree/bt_split.c61
-rw-r--r--db2/btree/bt_stat.c15
-rw-r--r--db2/common/db_appinit.c62
-rw-r--r--db2/common/db_apprec.c98
-rw-r--r--db2/common/db_byteorder.c7
-rw-r--r--db2/common/db_err.c8
-rw-r--r--db2/common/db_region.c4
-rw-r--r--db2/config.h8
-rw-r--r--db2/db.h9
-rw-r--r--db2/db/db.c24
-rw-r--r--db2/db/db_conv.c6
-rw-r--r--db2/db/db_dup.c16
-rw-r--r--db2/db/db_pr.c40
-rw-r--r--db2/db/db_ret.c4
-rw-r--r--db2/db185/db185.c3
-rw-r--r--db2/dbm/dbm.c14
-rw-r--r--db2/hash/hash_dup.c5
-rw-r--r--db2/include/db_am.h4
-rw-r--r--db2/include/db_page.h31
-rw-r--r--db2/include/mp.h11
-rw-r--r--db2/log/log.c2
-rw-r--r--db2/log/log_findckp.c4
-rw-r--r--db2/log/log_get.c4
-rw-r--r--db2/log/log_rec.c16
-rw-r--r--db2/mp/mp_bh.c59
-rw-r--r--db2/mp/mp_fopen.c4
-rw-r--r--db2/mp/mp_pr.c2
-rw-r--r--db2/mp/mp_sync.c14
-rw-r--r--db2/mutex/x86.gcc4
-rw-r--r--db2/os/db_os_dir.c6
-rw-r--r--db2/os/db_os_fid.c4
-rw-r--r--db2/progs/db_archive/db_archive.c7
-rw-r--r--db2/progs/db_checkpoint/db_checkpoint.c7
-rw-r--r--db2/progs/db_deadlock/db_deadlock.c9
-rw-r--r--db2/progs/db_dump/db_dump.c9
-rw-r--r--db2/progs/db_dump185/db_dump185.c19
-rw-r--r--db2/progs/db_load/db_load.c11
-rw-r--r--db2/progs/db_printlog/db_printlog.c8
-rw-r--r--db2/progs/db_recover/db_recover.c9
-rw-r--r--db2/progs/db_stat/db_stat.c11
-rw-r--r--db2/txn/txn.c18
-rw-r--r--db2/txn/txn_rec.c4
-rw-r--r--elf/dl-close.c23
-rw-r--r--elf/dl-deps.c11
-rw-r--r--elf/dl-open.c25
-rw-r--r--elf/dl-version.c9
-rw-r--r--elf/dlclose.c4
-rw-r--r--libio/stdfiles.c7
-rw-r--r--manual/maint.texi26
-rw-r--r--manual/math.texi5
-rw-r--r--manual/message.texi6
-rw-r--r--manual/string.texi8
-rw-r--r--nss/Makefile17
-rw-r--r--shlib-versions2
-rw-r--r--sunrpc/Makefile1
-rw-r--r--sunrpc/rpc_cout.c10
-rw-r--r--sysdeps/alpha/fpu/e_sqrt.c256
-rw-r--r--sysdeps/alpha/w_sqrt.S161
-rw-r--r--sysdeps/generic/_G_config.h (renamed from libio/_G_config.h)0
-rw-r--r--sysdeps/generic/stpcpy.c4
-rw-r--r--sysdeps/libm-ieee754/w_gamma.c2
-rw-r--r--sysdeps/libm-ieee754/w_gammaf.c2
-rw-r--r--sysdeps/libm-ieee754/w_gammal.c2
-rw-r--r--sysdeps/m68k/Makefile4
-rw-r--r--sysdeps/m68k/dl-machine.h4
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h67
-rw-r--r--termios/cfsetspeed.c8
-rw-r--r--termios/termios.h4
-rw-r--r--time/africa81
-rw-r--r--time/europe44
-rw-r--r--time/iso3166.tab4
-rw-r--r--time/northamerica7
-rw-r--r--time/southamerica6
-rw-r--r--time/zone.tab2
91 files changed, 1131 insertions, 670 deletions
diff --git a/ChangeLog b/ChangeLog
index b7d78e243e..663b4e2e6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,158 @@
+1997-09-05 03:15 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile (subdirs): Reorganize order so that nss follows add-ons.
+ * config.make.in (LDAP): Add.
+ * configure.in: Prepare for ldap add-on.
+ * shlib-versions: Add version numbers for ldap NSS module.
+ * nss/Makefile: Add rules to build ldap NSS module.
+
+ * db/btree/bt_page.c (__bt_free): Update meta data information.
+
+ Update db from db-2.3.6.
+ * db2/db.h: Updated.
+ * db2/btree/bt_close.c: Updated.
+ * db2/btree/bt_compare.c: Updated.
+ * db2/btree/bt_conv.c: Updated.
+ * db2/btree/bt_cursor.c: Updated.
+ * db2/btree/bt_delete.c: Updated.
+ * db2/btree/bt_put.c: Updated.
+ * db2/btree/bt_rec.c: Updated.
+ * db2/btree/bt_recno.c: Updated.
+ * db2/btree/bt_search.c: Updated.
+ * db2/btree/bt_split.c: Updated.
+ * db2/btree/bt_stat.c: Updated.
+ * db2/common/db_appinit.c: Updated.
+ * db2/common/db_apprec.c: Updated.
+ * db2/common/db_byteorder.c: Updated.
+ * db2/common/db_err.c: Updated.
+ * db2/common/db_region.c: Updated.
+ * db2/db/db.c: Updated.
+ * db2/db/db_conv.c: Updated.
+ * db2/db/db_dup.c: Updated.
+ * db2/db/db_pr.c: Updated.
+ * db2/db/db_ret.c: Updated.
+ * db2/db185/db185.c: Updated.
+ * db2/dbm/dbm.c: Updated.
+ * db2/hash/hash_dup.c: Updated.
+ * db2/include/db_am.h: Updated.
+ * db2/include/db_page.h: Updated.
+ * db2/include/mp.h: Updated.
+ * db2/include/queue.h: Updated.
+ * db2/log/log.c: Updated.
+ * db2/log/log_findckp.c: Updated.
+ * db2/log/log_get.c: Updated.
+ * db2/log/log_rec.c: Updated.
+ * db2/mp/mp_bh.c: Updated.
+ * db2/mp/mp_fopen.c: Updated.
+ * db2/mp/mp_pr.c: Updated.
+ * db2/mp/mp_sync.c: Updated.
+ * db2/mutex/x86.gcc: Updated.
+ * db2/os/db_os_dir.c: Updated.
+ * db2/os/db_os_fid.c: Updated.
+ * db2/progs/db_archive/db_archive.c: Updated.
+ * db2/progs/db_checkpoint/db_checkpoint.c: Updated.
+ * db2/progs/db_deadlock/db_deadlock.c: Updated.
+ * db2/progs/db_dump/db_dump.c: Updated.
+ * db2/progs/db_dump185/db_dump185.c: Updated.
+ * db2/progs/db_load/db_load.c: Updated.
+ * db2/progs/db_printlog/db_printlog.c: Updated.
+ * db2/progs/db_recover/db_recover.c: Updated.
+ * db2/progs/db_stat/db_stat.c: Updated.
+ * db2/txn/txn.c: Updated.
+ * db2/txn/txn_rec.c: Updated.
+
+ * db2/Makefile: Add rule to build db_printlog.
+ * db2/config.h: Don't include endian.h and don't define
+ WORDS_BIGENDIAN. Only define HAVE_ENDIAN_H.
+
+ * elf/dl-open.c (_dl_open): Make thread-safe.
+ * elf/dl-close.c (_dl_close): Likewise.
+ * elf/dlclose.c: Pretty print.
+ * elf/dl-version.c (make_string): Use __strdup not strdup.
+ (find_needed): Don't use l_searchlist of _dl_loaded, use the
+ l_next list.
+ * elf/dl-deps.c (_dl_map_object_deps): Remove variable head.
+
+ * manual/math.texi: Add note about == and != for FP values.
+ * manual/message.texi: Mention problems with relative paths and
+ binstextdomain.
+ * manual/string.texi: Mark strdupa and strndupa correctly as macros.
+
+ * sunrpc/Makefile (CFLAGS-xkey_prot.c): Define to prevent warnings.
+ * sunrpc/rpc_cout.c: Avoid needless races around return value.
+
+ * sysdeps/generic/stpcpy.c: Include <config.h> if wanted.
+
+ Update from tzdata-1997h.
+ * time/africa: Updated.
+ * time/europe: Updated.
+ * time/iso3166.tab: Updated.
+ * time/northamerica: Updated.
+ * time/southamerica: Updated.
+ * time/zone.tab: Updated.
+
+1997-09-04 13:19 Richard Henderson <rth@cygnus.com>
+
+ * sysdeps/alpha/w_sqrt.S: Removed.
+ * sysdeps/alpha/fpu/e_sqrt.c: New. Obey -mieee and -mieee-with-inexact
+ and build a version that is as fast as possible given the constraint.
+
+1997-08-30 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * manual/maint.texi: Document some defaults for configuration
+ parameters.
+
+1997-09-04 15:57 Ulrich Drepper <drepper@cygnus.com>
+
+ * termios/cfsetspeed.c (cfsetspeed): Change return value to int.
+ * termios/termios.h: Change prototype accordingly.
+ Reported by Andreas Jaeger <aj@arthur.rhein-neckar.de>.
+
+1997-07-26 14:42 H.J. Lu <hjl@gnu.ai.mit.edu>
+
+ * libio/stdfiles.c (_libio_using_thunks): Define if
+ _G_USING_THUNKS is defined.
+
+ * libio/_G_config.h: Moved to ...
+ * sysdeps/generic/_G_config.h: ...here.
+
+ * sysdeps/unix/sysv/linux/_G_config.h: New,
+ Add vtable thunks support.
+
+1997-09-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/m68k/Makefile (pic-ccflag): Override it for more
+ efficient code (together with a change in gcc).
+
+ * Makeconfig (pic-ccflag): New variable.
+ (CFLAGS-.os): Use it instead of hardcoding -fPIC.
+
+1997-09-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/m68k/dl-machine.h (elf_machine_load_address): Use
+ _dl_start instead of a local label, to avoid getting an unreadable
+ label name.
+
+1997-09-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * nss/Makefile ($(objpfx)libnss_db.so): Use $(dbobjdir) to find
+ libdb.so.
+
+ * Makeconfig (dbobjdir): Use db2.
+
+1997-08-31 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * manual/maint.texi (Porting to Unix): Update description of the
+ implementation of Unix system calls.
+ (Contributors): Use real umlaut in tege's name.
+
+1997-08-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/libm-ieee754/w_gamma.c: Make compilable with
+ _IEEE_LIBM.
+ * sysdeps/libm-ieee754/w_gammaf.c: Likewise.
+ * sysdeps/libm-ieee754/w_gammal.c: Likewise.
+
1997-08-29 21:45 Ulrich Drepper <drepper@cygnus.com>
* sunrpc/auth_des.c: New file. Copied from former secure_rpc add-on.
diff --git a/Makeconfig b/Makeconfig
index 185c16cf6d..53dedee507 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -388,7 +388,7 @@ rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(dbobjdir
mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
-dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db)
+dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
else
link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
endif
@@ -537,8 +537,10 @@ ifeq (yes,$(build-shared))
# The PIC object files are named foo.os.
object-suffixes += .os
CPPFLAGS-.os = -DPIC
-CFLAGS-.os = -fPIC -fno-common
+CFLAGS-.os = $(pic-ccflag) -fno-common
libtype.os := lib%_pic.a
+# This can be changed by a sysdep makefile
+pic-ccflag = -fPIC
endif
ifeq (yes,$(build-profile))
# Under --enable-profile, we will build a static library of profiled objects.
diff --git a/Makefile b/Makefile
index 5c233c860f..9d66fb49b0 100644
--- a/Makefile
+++ b/Makefile
@@ -54,8 +54,8 @@ endif
subdirs = csu assert ctype db2 locale intl catgets math setjmp signal stdlib \
stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \
posix io termios resource misc socket sysvipc gmon gnulib \
- wctype manual shadow md5-crypt nss $(sysdep-subdirs) po argp \
- $(add-ons) $(binfmt-subdir)
+ wctype manual shadow md5-crypt po argp $(add-ons) nss \
+ $(sysdep-subdirs) $(binfmt-subdir)
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
# The mach and hurd subdirectories have many generated header files which
diff --git a/config.make.in b/config.make.in
index 14ce430a30..8472c496ec 100644
--- a/config.make.in
+++ b/config.make.in
@@ -46,6 +46,8 @@ stdio = @stdio@
add-ons = @subdirs@
cross-compiling = @cross_compiling@
+LDAP = @LDAP@
+
# Build tools.
CC = @CC@
BUILD_CC = @BUILD_CC@
diff --git a/configure b/configure
index 1e18d28155..a3fb9989ad 100755
--- a/configure
+++ b/configure
@@ -2161,6 +2161,18 @@ default) stdio=stdio ;;
esac
echo "$ac_t""$stdio" 1>&6
+echo $ac_n "checking ldap selection""... $ac_c" 1>&6
+echo "configure:2166: checking ldap selection" >&5
+
+case $add_ons in
+*ldap*)
+ ldap=yes
+ LDAP=ldap ;;
+*) ldap=no
+ LDAP= ;;
+esac
+echo "$ac_t""$ldap" 1>&6
+
@@ -2381,6 +2393,7 @@ s%@uname_sysname@%$uname_sysname%g
s%@uname_release@%$uname_release%g
s%@uname_version@%$uname_version%g
s%@stdio@%$stdio%g
+s%@LDAP@%$LDAP%g
s%@libc_cv_slibdir@%$libc_cv_slibdir%g
s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g
diff --git a/configure.in b/configure.in
index b1e1bf7d12..fd7e49bc0e 100644
--- a/configure.in
+++ b/configure.in
@@ -798,6 +798,17 @@ default) stdio=stdio ;;
esac
AC_MSG_RESULT($stdio)
+AC_MSG_CHECKING(ldap selection)
+AC_SUBST(LDAP)
+case $add_ons in
+*ldap*)
+ ldap=yes
+ LDAP=ldap ;;
+*) ldap=no
+ LDAP= ;;
+esac
+AC_MSG_RESULT($ldap)
+
AC_SUBST(libc_cv_slibdir)
AC_SUBST(libc_cv_sysconfdir)
AC_SUBST(libc_cv_rootsbindir)
diff --git a/db/btree/bt_page.c b/db/btree/bt_page.c
index 0d9d138d5c..ce9cbf15a6 100644
--- a/db/btree/bt_page.c
+++ b/db/btree/bt_page.c
@@ -65,6 +65,7 @@ __bt_free(t, h)
h->prevpg = P_INVALID;
h->nextpg = t->bt_free;
t->bt_free = h->pgno;
+ F_SET(t, B_METADIRTY);
/* Make sure the page gets written back. */
return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
@@ -92,6 +93,7 @@ __bt_new(t, npg)
(h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
*npg = t->bt_free;
t->bt_free = h->nextpg;
+ F_SET(t, B_METADIRTY);
return (h);
}
return (mpool_new(t->bt_mp, npg));
diff --git a/db2/Makefile b/db2/Makefile
index a7521b6580..a75dc5aef1 100644
--- a/db2/Makefile
+++ b/db2/Makefile
@@ -19,7 +19,7 @@
#
# Sub-makefile for libdb.
#
-# The code is lifted straight from the db 2.3.4 distribution
+# The code is lifted straight from the db 2.3.6 distribution
# with minimal changes.
#
@@ -90,6 +90,7 @@ $(objpfx)db_checkpoint: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_deadlock: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_dump: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_load: $(objpfx)libdb.so$(libdb.so-version)
+$(objpfx)db_printlog: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_recover: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_stat: $(objpfx)libdb.so$(libdb.so-version)
else
@@ -100,6 +101,7 @@ $(objpfx)db_checkpoint: $(objpfx)libdb.a
$(objpfx)db_deadlock: $(objpfx)libdb.a
$(objpfx)db_dump: $(objpfx)libdb.a
$(objpfx)db_load: $(objpfx)libdb.a
+$(objpfx)db_printlog: $(objpfx)libdb.a
$(objpfx)db_recover: $(objpfx)libdb.a
$(objpfx)db_stat: $(objpfx)libdb.a
endif
diff --git a/db2/btree/bt_close.c b/db2/btree/bt_close.c
index 4e80634e86..7044599dd2 100644
--- a/db2/btree/bt_close.c
+++ b/db2/btree/bt_close.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_close.c 10.22 (Sleepycat) 8/23/97";
+static const char sccsid[] = "@(#)bt_close.c 10.23 (Sleepycat) 9/2/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -157,14 +157,12 @@ __bam_upstat(dbp)
if (F_ISSET(dbp, DB_AM_INMEM | DB_AM_RDONLY))
return;
- /* Lock the page. */
- if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock) != 0)
- return;
-
flags = 0;
pgno = PGNO_METADATA;
- /* Get the page. */
+ /* Lock and retrieve the page. */
+ if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock) != 0)
+ return;
if (__bam_pget(dbp, (PAGE **)&meta, &pgno, 0) == 0) {
/* Log the change. */
if (DB_LOGGING(dbp) &&
diff --git a/db2/btree/bt_compare.c b/db2/btree/bt_compare.c
index e802fd24ab..a68b1fa891 100644
--- a/db2/btree/bt_compare.c
+++ b/db2/btree/bt_compare.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_compare.c 10.3 (Sleepycat) 7/19/97";
+static const char sccsid[] = "@(#)bt_compare.c 10.4 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -103,7 +103,7 @@ __bam_cmp(dbp, k1, e)
bo = NULL;
if (TYPE(h) == P_LBTREE) {
bk = GET_BKEYDATA(h, e->indx);
- if (bk->type == B_OVERFLOW)
+ if (B_TYPE(bk->type) == B_OVERFLOW)
bo = (BOVERFLOW *)bk;
else {
memset(&k2, 0, sizeof(k2));
@@ -112,7 +112,7 @@ __bam_cmp(dbp, k1, e)
}
} else {
bi = GET_BINTERNAL(h, e->indx);
- if (bi->type == B_OVERFLOW)
+ if (B_TYPE(bi->type) == B_OVERFLOW)
bo = (BOVERFLOW *)(bi->data);
else {
memset(&k2, 0, sizeof(k2));
diff --git a/db2/btree/bt_conv.c b/db2/btree/bt_conv.c
index 537e2f98ec..c9d5d1bc3e 100644
--- a/db2/btree/bt_conv.c
+++ b/db2/btree/bt_conv.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_conv.c 10.3 (Sleepycat) 8/9/97";
+static const char sccsid[] = "@(#)bt_conv.c 10.4 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -69,6 +69,8 @@ __bam_mswap(pg)
u_int8_t *p;
p = (u_int8_t *)pg;
+
+ /* Swap the meta-data information. */
SWAP32(p); /* lsn.file */
SWAP32(p); /* lsn.offset */
SWAP32(p); /* pgno */
@@ -79,5 +81,19 @@ __bam_mswap(pg)
SWAP32(p); /* minkey */
SWAP32(p); /* free */
SWAP32(p); /* flags */
+
+ /* Swap the statistics. */
+ p = (u_int8_t *)&((BTMETA *)pg)->stat;
+ SWAP32(p); /* bt_freed */
+ SWAP32(p); /* bt_pfxsaved */
+ SWAP32(p); /* bt_split */
+ SWAP32(p); /* bt_rootsplit */
+ SWAP32(p); /* bt_fastsplit */
+ SWAP32(p); /* bt_added */
+ SWAP32(p); /* bt_deleted */
+ SWAP32(p); /* bt_get */
+ SWAP32(p); /* bt_cache_hit */
+ SWAP32(p); /* bt_cache_miss */
+
return (0);
}
diff --git a/db2/btree/bt_cursor.c b/db2/btree/bt_cursor.c
index 592ec9b3ff..efae556030 100644
--- a/db2/btree/bt_cursor.c
+++ b/db2/btree/bt_cursor.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_cursor.c 10.26 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)bt_cursor.c 10.27 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -201,9 +201,9 @@ __bam_c_del(dbc, flags)
/* Set the intent-to-delete flag on the page and in all cursors. */
if (cp->dpgno == PGNO_INVALID)
- GET_BKEYDATA(h, indx + O_INDX)->deleted = 1;
+ B_DSET(GET_BKEYDATA(h, indx + O_INDX)->type);
else
- GET_BKEYDATA(h, indx)->deleted = 1;
+ B_DSET(GET_BKEYDATA(h, indx)->type);
(void)__bam_ca_delete(dbp, pgno, indx, NULL);
ret = memp_fput(dbp->mpf, h, DB_MPOOL_DIRTY);
@@ -643,7 +643,7 @@ __bam_c_first(dbp, cp)
/* If it's an empty page or a deleted record, go to the next one. */
if (NUM_ENT(cp->page) == 0 ||
- GET_BKEYDATA(cp->page, cp->indx + O_INDX)->deleted)
+ B_DISSET(GET_BKEYDATA(cp->page, cp->indx + O_INDX)->type))
if ((ret = __bam_c_next(dbp, cp, 0)) != 0)
return (ret);
@@ -653,7 +653,7 @@ __bam_c_first(dbp, cp)
/* If it's a deleted record, go to the next one. */
if (cp->dpgno != PGNO_INVALID &&
- GET_BKEYDATA(cp->page, cp->dindx)->deleted)
+ B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type))
if ((ret = __bam_c_next(dbp, cp, 0)) != 0)
return (ret);
return (0);
@@ -694,7 +694,7 @@ __bam_c_last(dbp, cp)
/* If it's an empty page or a deleted record, go to the previous one. */
if (NUM_ENT(cp->page) == 0 ||
- GET_BKEYDATA(cp->page, cp->indx + O_INDX)->deleted)
+ B_DISSET(GET_BKEYDATA(cp->page, cp->indx + O_INDX)->type))
if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret);
@@ -704,7 +704,7 @@ __bam_c_last(dbp, cp)
/* If it's a deleted record, go to the previous one. */
if (cp->dpgno != PGNO_INVALID &&
- GET_BKEYDATA(cp->page, cp->dindx)->deleted)
+ B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type))
if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret);
return (0);
@@ -793,9 +793,9 @@ __bam_c_next(dbp, cp, initial_move)
/* Ignore deleted records. */
if (dbp->type == DB_BTREE &&
((cp->dpgno == PGNO_INVALID &&
- GET_BKEYDATA(cp->page, indx + O_INDX)->deleted) ||
+ B_DISSET(GET_BKEYDATA(cp->page, indx + O_INDX)->type)) ||
(cp->dpgno != PGNO_INVALID &&
- GET_BKEYDATA(cp->page, indx)->deleted))) {
+ B_DISSET(GET_BKEYDATA(cp->page, indx)->type)))) {
indx += adjust;
continue;
}
@@ -908,9 +908,9 @@ __bam_c_prev(dbp, cp)
indx -= adjust;
if (dbp->type == DB_BTREE &&
((cp->dpgno == PGNO_INVALID &&
- GET_BKEYDATA(cp->page, indx + O_INDX)->deleted) ||
+ B_DISSET(GET_BKEYDATA(cp->page, indx + O_INDX)->type)) ||
(cp->dpgno != PGNO_INVALID &&
- GET_BKEYDATA(cp->page, indx)->deleted)))
+ B_DISSET(GET_BKEYDATA(cp->page, indx)->type))))
continue;
/*
@@ -997,7 +997,7 @@ __bam_c_search(dbp, cp, key, flags, isrecno, exactp)
/* If it's a deleted record, go to the next or previous one. */
if (cp->dpgno != PGNO_INVALID &&
- GET_BKEYDATA(cp->page, cp->dindx)->deleted)
+ B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type))
if (flags == S_KEYLAST) {
if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret);
@@ -1027,7 +1027,7 @@ __bam_ovfl_chk(dbp, cp, indx, to_end)
/* Check for an overflow entry. */
bo = GET_BOVERFLOW(cp->page, indx);
- if (bo->type != B_DUPLICATE)
+ if (B_TYPE(bo->type) != B_DUPLICATE)
return (0);
/*
diff --git a/db2/btree/bt_delete.c b/db2/btree/bt_delete.c
index e7ec4dfe3e..98929540e4 100644
--- a/db2/btree/bt_delete.c
+++ b/db2/btree/bt_delete.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_delete.c 10.18 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)bt_delete.c 10.21 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -107,7 +107,7 @@ __bam_delete(argdbp, txn, key, flags)
break;
for (; cnt > 0; --cnt, ++t->lstat.bt_deleted)
if (__bam_ca_delete(dbp, h->pgno, indx, NULL) != 0) {
- GET_BKEYDATA(h, indx + O_INDX)->deleted = 1;
+ B_DSET(GET_BKEYDATA(h, indx + O_INDX)->type);
indx += P_INDX;
} else if ((ret = __bam_ditem(dbp, h, indx)) != 0 ||
(ret = __bam_ditem(dbp, h, indx)) != 0)
@@ -180,7 +180,7 @@ __ram_delete(argdbp, txn, key, flags)
stack = 1;
/* If the record has already been deleted, we couldn't have found it. */
- if (GET_BKEYDATA(h, indx)->deleted) {
+ if (B_DISSET(GET_BKEYDATA(h, indx)->type)) {
ret = DB_KEYEMPTY;
goto done;
}
@@ -193,14 +193,13 @@ __ram_delete(argdbp, txn, key, flags)
if ((ret = __bam_ditem(dbp, h, indx)) != 0)
goto err;
- bk.deleted = 1;
- bk.type = B_KEYDATA;
+ B_TSET(bk.type, B_KEYDATA, 1);
bk.len = 0;
memset(&hdr, 0, sizeof(hdr));
hdr.data = &bk;
hdr.size = SSZA(BKEYDATA, data);
memset(&data, 0, sizeof(data));
- data.data = (char *) "";
+ data.data = (char *)"";
data.size = 0;
if ((ret = __db_pitem(dbp,
h, indx, BKEYDATA_SIZE(0), &hdr, &data)) != 0)
@@ -263,7 +262,7 @@ __bam_ditem(dbp, h, indx)
switch (TYPE(h)) {
case P_IBTREE:
bi = GET_BINTERNAL(h, indx);
- switch (bi->type) {
+ switch (B_TYPE(bi->type)) {
case B_DUPLICATE:
case B_OVERFLOW:
nbytes = BINTERNAL_SIZE(bi->len);
@@ -298,14 +297,14 @@ __bam_ditem(dbp, h, indx)
/* FALLTHROUGH */
case P_LRECNO:
bk = GET_BKEYDATA(h, indx);
- switch (bk->type) {
+ switch (B_TYPE(bk->type)) {
case B_DUPLICATE:
case B_OVERFLOW:
nbytes = BOVERFLOW_SIZE;
offpage: /* Delete duplicate/offpage chains. */
bo = GET_BOVERFLOW(h, indx);
- if (bo->type == B_DUPLICATE) {
+ if (B_TYPE(bo->type) == B_DUPLICATE) {
if ((ret =
__db_ddup(dbp, bo->pgno, __bam_free)) != 0)
return (ret);
diff --git a/db2/btree/bt_put.c b/db2/btree/bt_put.c
index 632c3d185b..0f0b1e7126 100644
--- a/db2/btree/bt_put.c
+++ b/db2/btree/bt_put.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_put.c 10.23 (Sleepycat) 8/22/97";
+static const char sccsid[] = "@(#)bt_put.c 10.24 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -120,7 +120,7 @@ retry: /*
*/
replace = 0;
if (exact && flags == DB_NOOVERWRITE) {
- if (!GET_BKEYDATA(h, indx + O_INDX)->deleted) {
+ if (!B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type)) {
ret = DB_KEYEXIST;
goto err;
}
@@ -436,16 +436,14 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
*/
bigkey = bigdata = 0;
if (LF_ISSET(BI_NEWKEY) && key->size > t->bt_ovflsize) {
- kbo.deleted = 0;
- kbo.type = B_OVERFLOW;
+ B_TSET(kbo.type, B_OVERFLOW, 0);
kbo.tlen = key->size;
if ((ret = __db_poff(dbp, key, &kbo.pgno, __bam_new)) != 0)
goto err;
bigkey = 1;
}
if (data->size > t->bt_ovflsize) {
- dbo.deleted = 0;
- dbo.type = B_OVERFLOW;
+ B_TSET(dbo.type, B_OVERFLOW, 0);
dbo.tlen = data->size;
if ((ret = __db_poff(dbp, data, &dbo.pgno, __bam_new)) != 0)
goto err;
@@ -472,7 +470,7 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
if (op == DB_CURRENT) {
bk = GET_BKEYDATA(h,
indx + (TYPE(h) == P_LBTREE ? O_INDX : 0));
- if (bk->type == B_OVERFLOW)
+ if (B_TYPE(bk->type) == B_OVERFLOW)
have_bytes = BOVERFLOW_PSIZE;
else
have_bytes = BKEYDATA_PSIZE(bk->len);
@@ -492,7 +490,7 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
* alignment) and do a delete/insert otherwise.
*/
if (op == DB_CURRENT && !bigdata &&
- bk->type == B_KEYDATA && have_bytes == need_bytes)
+ B_TYPE(bk->type) == B_KEYDATA && have_bytes == need_bytes)
dcopy = 1;
if (have_bytes < need_bytes)
needed += need_bytes - have_bytes;
@@ -622,9 +620,8 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
__data.size = data->size;
if (LF_ISSET(BI_DELETED)) {
+ B_TSET(__bk.type, B_KEYDATA, 1);
__bk.len = __data.size;
- __bk.deleted = 1;
- __bk.type = B_KEYDATA;
__hdr.data = &__bk;
__hdr.size = SSZA(BKEYDATA, data);
ret = __db_pitem(dbp, h, indx,
@@ -687,10 +684,10 @@ __bam_ndup(dbp, h, indx)
if (indx >= NUM_ENT(h) || h->inp[first] != h->inp[indx])
break;
bk = GET_BKEYDATA(h, indx);
- sz += bk->type == B_KEYDATA ?
+ sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
bk = GET_BKEYDATA(h, indx + O_INDX);
- sz += bk->type == B_KEYDATA ?
+ sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
}
@@ -716,7 +713,7 @@ __bam_ndup(dbp, h, indx)
/* Copy the entry to the new page. */
bk = GET_BKEYDATA(h, indx);
hdr.data = bk;
- hdr.size = bk->type == B_KEYDATA ?
+ hdr.size = B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_SIZE(bk->len) : BOVERFLOW_SIZE;
if ((ret =
__db_pitem(dbp, cp, cpindx, hdr.size, &hdr, NULL)) != 0)
@@ -743,8 +740,7 @@ __bam_ndup(dbp, h, indx)
}
/* Put in a new data item that points to the duplicates page. */
- bo.deleted = 0;
- bo.type = B_DUPLICATE;
+ B_TSET(bo.type, B_DUPLICATE, 0);
bo.pgno = cp->pgno;
bo.tlen = 0;
@@ -828,14 +824,14 @@ __bam_partial(dbp, dbt, h, indx)
*/
if (indx < NUM_ENT(h)) {
bk = GET_BKEYDATA(h, indx + (TYPE(h) == P_LBTREE ? O_INDX : 0));
- if (bk->type == B_OVERFLOW) {
+ if (B_TYPE(bk->type) == B_OVERFLOW) {
bo = (BOVERFLOW *)bk;
nbytes = bo->tlen;
} else
nbytes = bk->len;
} else {
bk = &tbk;
- bk->type = B_KEYDATA;
+ B_TSET(bk->type, B_KEYDATA, 0);
nbytes = bk->len = 0;
}
nbytes += dbt->doff + dbt->size + dbt->dlen;
@@ -856,7 +852,7 @@ __bam_partial(dbp, dbt, h, indx)
memset(t->bt_rdata.data, 0, nbytes);
tlen = 0;
- if (bk->type == B_OVERFLOW) {
+ if (B_TYPE(bk->type) == B_OVERFLOW) {
/* Take up to doff bytes from the record. */
memset(&copy, 0, sizeof(copy));
if ((ret = __db_goff(dbp, &copy, bo->tlen,
diff --git a/db2/btree/bt_rec.c b/db2/btree/bt_rec.c
index d4bc7f6824..bf48e01d54 100644
--- a/db2/btree/bt_rec.c
+++ b/db2/btree/bt_rec.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_rec.c 10.11 (Sleepycat) 8/22/97";
+static const char sccsid[] = "@(#)bt_rec.c 10.13 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -60,7 +60,7 @@ __bam_pg_alloc_recover(logp, dbtp, lsnp, redo, info)
* Fix up the allocated page. If we're redoing the operation, we have
* to get the page (creating it if it doesn't exist), and update its
* LSN. If we're undoing the operation, we have to reset the page's
- * LSN and put it on the free list.
+ * LSN and put it on the free list.
*
* Fix up the metadata page. If we're redoing the operation, we have
* to get the metadata page and update its LSN and its free pointer.
@@ -749,13 +749,13 @@ __bam_cdel_recover(logp, dbtp, lsnp, redo, info)
cmp_p = log_compare(&LSN(pagep), &argp->lsn);
if (cmp_p == 0 && redo) {
/* Need to redo update described. */
- GET_BKEYDATA(pagep, argp->indx + O_INDX)->deleted = 1;
+ B_DSET(GET_BKEYDATA(pagep, argp->indx + O_INDX)->type);
LSN(pagep) = *lsnp;
modified = 1;
} else if (cmp_n == 0 && !redo) {
/* Need to undo update described. */
- GET_BKEYDATA(pagep, argp->indx + O_INDX)->deleted = 0;
+ B_DCLR(GET_BKEYDATA(pagep, argp->indx + O_INDX)->type);
LSN(pagep) = argp->lsn;
modified = 1;
diff --git a/db2/btree/bt_recno.c b/db2/btree/bt_recno.c
index cd8872a064..42ef9cc30d 100644
--- a/db2/btree/bt_recno.c
+++ b/db2/btree/bt_recno.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_recno.c 10.12 (Sleepycat) 8/25/97";
+static const char sccsid[] = "@(#)bt_recno.c 10.15 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -246,7 +246,7 @@ __ram_get(argdbp, txn, key, data, flags)
indx = t->bt_csp->indx;
/* If the record has already been deleted, we couldn't have found it. */
- if (GET_BKEYDATA(h, indx)->deleted) {
+ if (B_DISSET(GET_BKEYDATA(h, indx)->type)) {
ret = DB_KEYEMPTY;
goto done;
}
@@ -981,7 +981,7 @@ __ram_writeback(dbp)
if ((ret =
__db_write(fd, pad, rp->re_len, &nw)) != 0)
goto err;
- if (nw != (ssize_t) rp->re_len) {
+ if (nw != (ssize_t)rp->re_len) {
ret = EIO;
goto err;
}
diff --git a/db2/btree/bt_search.c b/db2/btree/bt_search.c
index d5f20d4c61..fa3e018313 100644
--- a/db2/btree/bt_search.c
+++ b/db2/btree/bt_search.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_search.c 10.6 (Sleepycat) 8/22/97";
+static const char sccsid[] = "@(#)bt_search.c 10.7 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -258,17 +258,17 @@ match: *exactp = 1;
*/
if (LF_ISSET(S_DELNO)) {
if (LF_ISSET(S_DUPLAST))
- while (GET_BKEYDATA(h, indx + O_INDX)->deleted &&
+ while (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type) &&
indx > 0 &&
h->inp[indx] == h->inp[indx - P_INDX])
indx -= P_INDX;
else
- while (GET_BKEYDATA(h, indx + O_INDX)->deleted &&
+ while (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type) &&
indx < (db_indx_t)(NUM_ENT(h) - P_INDX) &&
h->inp[indx] == h->inp[indx + P_INDX])
indx += P_INDX;
- if (GET_BKEYDATA(h, indx + O_INDX)->deleted)
+ if (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type))
goto notfound;
}
diff --git a/db2/btree/bt_split.c b/db2/btree/bt_split.c
index 89cfcb5a2e..25cfacc4d0 100644
--- a/db2/btree/bt_split.c
+++ b/db2/btree/bt_split.c
@@ -44,7 +44,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_split.c 10.12 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)bt_split.c 10.14 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -394,8 +394,7 @@ __bam_broot(dbp, rootp, lp, rp)
* level of the tree is never used, so it doesn't need to be filled in.
*/
bi.len = 0;
- bi.deleted = 0;
- bi.type = B_KEYDATA;
+ B_TSET(bi.type, B_KEYDATA, 0);
bi.pgno = lp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(lp);
@@ -405,7 +404,7 @@ __bam_broot(dbp, rootp, lp, rp)
hdr.data = &bi;
hdr.size = SSZA(BINTERNAL, data);
memset(&data, 0, sizeof(data));
- data.data = (char *) "";
+ data.data = (char *)"";
data.size = 0;
if ((ret =
__db_pitem(dbp, rootp, 0, BINTERNAL_SIZE(0), &hdr, &data)) != 0)
@@ -417,8 +416,7 @@ __bam_broot(dbp, rootp, lp, rp)
child_bi = GET_BINTERNAL(rp, 0);
bi.len = child_bi->len;
- bi.deleted = 0;
- bi.type = child_bi->type;
+ B_TSET(bi.type, child_bi->type, 0);
bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp);
@@ -433,18 +431,17 @@ __bam_broot(dbp, rootp, lp, rp)
return (ret);
/* Increment the overflow ref count. */
- if (child_bi->type == B_OVERFLOW && (ret =
+ if (B_TYPE(child_bi->type) == B_OVERFLOW && (ret =
__db_ioff(dbp, ((BOVERFLOW *)(child_bi->data))->pgno)) != 0)
return (ret);
break;
case P_LBTREE:
/* Copy the first key of the child page onto the root page. */
child_bk = GET_BKEYDATA(rp, 0);
- switch (child_bk->type) {
+ switch (B_TYPE(child_bk->type)) {
case B_KEYDATA:
bi.len = child_bk->len;
- bi.deleted = 0;
- bi.type = child_bk->type;
+ B_TSET(bi.type, child_bk->type, 0);
bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp);
@@ -461,8 +458,7 @@ __bam_broot(dbp, rootp, lp, rp)
case B_DUPLICATE:
case B_OVERFLOW:
bi.len = BOVERFLOW_SIZE;
- bi.deleted = 0;
- bi.type = child_bk->type;
+ B_TSET(bi.type, child_bk->type, 0);
bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp);
@@ -477,7 +473,7 @@ __bam_broot(dbp, rootp, lp, rp)
return (ret);
/* Increment the overflow ref count. */
- if (child_bk->type == B_OVERFLOW && (ret =
+ if (B_TYPE(child_bk->type) == B_OVERFLOW && (ret =
__db_ioff(dbp, ((BOVERFLOW *)child_bk)->pgno)) != 0)
return (ret);
break;
@@ -594,8 +590,7 @@ __bam_pinsert(dbp, parent, lchild, rchild)
/* Add a new record for the right page. */
bi.len = child_bi->len;
- bi.deleted = 0;
- bi.type = child_bi->type;
+ B_TSET(bi.type, child_bi->type, 0);
bi.pgno = rchild->pgno;
bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr));
@@ -609,13 +604,13 @@ __bam_pinsert(dbp, parent, lchild, rchild)
return (ret);
/* Increment the overflow ref count. */
- if (child_bi->type == B_OVERFLOW && (ret =
+ if (B_TYPE(child_bi->type) == B_OVERFLOW && (ret =
__db_ioff(dbp, ((BOVERFLOW *)(child_bi->data))->pgno)) != 0)
return (ret);
break;
case P_LBTREE:
child_bk = GET_BKEYDATA(rchild, 0);
- switch (child_bk->type) {
+ switch (B_TYPE(child_bk->type)) {
case B_KEYDATA:
nbytes = BINTERNAL_PSIZE(child_bk->len);
nksize = child_bk->len;
@@ -624,7 +619,7 @@ __bam_pinsert(dbp, parent, lchild, rchild)
if (ppage->prev_pgno == PGNO_INVALID && off <= 1)
goto noprefix;
tmp_bk = GET_BKEYDATA(lchild, NUM_ENT(lchild) - P_INDX);
- if (tmp_bk->type != B_KEYDATA)
+ if (B_TYPE(tmp_bk->type) != B_KEYDATA)
goto noprefix;
memset(&a, 0, sizeof(a));
a.size = tmp_bk->len;
@@ -643,8 +638,7 @@ noprefix: nksize = child_bk->len;
return (DB_NEEDSPLIT);
bi.len = nksize;
- bi.deleted = 0;
- bi.type = child_bk->type;
+ B_TSET(bi.type, child_bk->type, 0);
bi.pgno = rchild->pgno;
bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr));
@@ -665,8 +659,7 @@ noprefix: nksize = child_bk->len;
return (DB_NEEDSPLIT);
bi.len = BOVERFLOW_SIZE;
- bi.deleted = 0;
- bi.type = child_bk->type;
+ B_TSET(bi.type, child_bk->type, 0);
bi.pgno = rchild->pgno;
bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr));
@@ -680,7 +673,7 @@ noprefix: nksize = child_bk->len;
return (ret);
/* Increment the overflow ref count. */
- if (child_bk->type == B_OVERFLOW && (ret =
+ if (B_TYPE(child_bk->type) == B_OVERFLOW && (ret =
__db_ioff(dbp, ((BOVERFLOW *)child_bk)->pgno)) != 0)
return (ret);
break;
@@ -796,21 +789,21 @@ __bam_psplit(dbp, cp, lp, rp, cleft)
for (nbytes = 0, off = 0; off < top && nbytes < half; ++off)
switch (TYPE(pp)) {
case P_IBTREE:
- if (GET_BINTERNAL(pp, off)->type == B_KEYDATA)
+ if (B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA)
nbytes +=
BINTERNAL_SIZE(GET_BINTERNAL(pp, off)->len);
else
nbytes += BINTERNAL_SIZE(BOVERFLOW_SIZE);
break;
case P_LBTREE:
- if (GET_BKEYDATA(pp, off)->type == B_KEYDATA)
+ if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)
nbytes +=
BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len);
else
nbytes += BOVERFLOW_SIZE;
++off;
- if (GET_BKEYDATA(pp, off)->type == B_KEYDATA)
+ if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)
nbytes +=
BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len);
else
@@ -832,9 +825,9 @@ sort: splitp = off;
* it's a big key, try and find something close by that's not.
*/
if (TYPE(pp) == P_IBTREE)
- isbigkey = GET_BINTERNAL(pp, off)->type != B_KEYDATA;
+ isbigkey = B_TYPE(GET_BINTERNAL(pp, off)->type) != B_KEYDATA;
else if (TYPE(pp) == P_LBTREE)
- isbigkey = GET_BKEYDATA(pp, off)->type != B_KEYDATA;
+ isbigkey = B_TYPE(GET_BKEYDATA(pp, off)->type) != B_KEYDATA;
else
isbigkey = 0;
if (isbigkey)
@@ -842,8 +835,8 @@ sort: splitp = off;
off = splitp + cnt * adjust;
if (off < (db_indx_t)NUM_ENT(pp) &&
((TYPE(pp) == P_IBTREE &&
- GET_BINTERNAL(pp, off)->type == B_KEYDATA) ||
- GET_BKEYDATA(pp, off)->type == B_KEYDATA)) {
+ B_TYPE(GET_BINTERNAL(pp,off)->type) == B_KEYDATA) ||
+ B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)) {
splitp = off;
break;
}
@@ -851,8 +844,8 @@ sort: splitp = off;
continue;
off = splitp - cnt * adjust;
if (TYPE(pp) == P_IBTREE ?
- GET_BINTERNAL(pp, off)->type == B_KEYDATA :
- GET_BKEYDATA(pp, off)->type == B_KEYDATA) {
+ B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA :
+ B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA) {
splitp = off;
break;
}
@@ -915,7 +908,7 @@ __bam_copy(dbp, pp, cp, nxt, stop)
for (dup = off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) {
switch (TYPE(pp)) {
case P_IBTREE:
- if (GET_BINTERNAL(pp, nxt)->type == B_KEYDATA)
+ if (B_TYPE(GET_BINTERNAL(pp, nxt)->type) == B_KEYDATA)
nbytes =
BINTERNAL_SIZE(GET_BINTERNAL(pp, nxt)->len);
else
@@ -933,7 +926,7 @@ __bam_copy(dbp, pp, cp, nxt, stop)
}
/* FALLTHROUGH */
case P_LRECNO:
- if (GET_BKEYDATA(pp, nxt)->type == B_KEYDATA)
+ if (B_TYPE(GET_BKEYDATA(pp, nxt)->type) == B_KEYDATA)
nbytes =
BKEYDATA_SIZE(GET_BKEYDATA(pp, nxt)->len);
else
diff --git a/db2/btree/bt_stat.c b/db2/btree/bt_stat.c
index ba71ea616d..ab3bc4c431 100644
--- a/db2/btree/bt_stat.c
+++ b/db2/btree/bt_stat.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_stat.c 10.11 (Sleepycat) 8/19/97";
+static const char sccsid[] = "@(#)bt_stat.c 10.12 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -140,6 +140,11 @@ __bam_stat(argdbp, spp, db_malloc, flags)
(void)memp_fput(dbp->mpf, meta, 0);
(void)__BT_TLPUT(dbp, lock);
+ /* Determine the last page of the database. */
+ if ((ret = memp_fget(dbp->mpf, &lastpgno, DB_MPOOL_LAST, &h)) != 0)
+ goto err;
+ (void)memp_fput(dbp->mpf, h, 0);
+
/* Get the root page. */
pgno = PGNO_ROOT;
if ((ret = __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_READ, &lock)) != 0)
@@ -152,13 +157,7 @@ __bam_stat(argdbp, spp, db_malloc, flags)
/* Get the levels from the root page. */
sp->bt_levels = h->level;
- /*
- * Determine the last page of the database, then walk it, counting
- * things.
- */
- if ((ret = memp_fget(dbp->mpf, &lastpgno, DB_MPOOL_LAST, &h)) != 0)
- goto err;
- (void)memp_fput(dbp->mpf, h, 0);
+ /* Walk the page list, counting things. */
for (;;) {
switch (TYPE(h)) {
case P_INVALID:
diff --git a/db2/common/db_appinit.c b/db2/common/db_appinit.c
index 01891c66a7..51d9262859 100644
--- a/db2/common/db_appinit.c
+++ b/db2/common/db_appinit.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_appinit.c 10.27 (Sleepycat) 8/23/97";
+static const char sccsid[] = "@(#)db_appinit.c 10.33 (Sleepycat) 8/28/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -43,7 +43,7 @@ static int __db_tmp_open __P((DB_ENV *, char *, int *));
* db_version --
* Return verision information.
*/
-const char *
+char *
db_version(majverp, minverp, patchp)
int *majverp, *minverp, *patchp;
{
@@ -53,7 +53,7 @@ db_version(majverp, minverp, patchp)
*minverp = DB_VERSION_MINOR;
if (patchp != NULL)
*patchp = DB_VERSION_PATCH;
- return (DB_VERSION_STRING);
+ return ((char *)DB_VERSION_STRING);
}
/*
@@ -68,7 +68,7 @@ db_appinit(db_home, db_config, dbenv, flags)
int flags;
{
FILE *fp;
- int i_lock, i_log, i_mpool, i_txn, ret;
+ int ret;
char *lp, **p, buf[MAXPATHLEN * 2];
/* Validate arguments. */
@@ -94,7 +94,6 @@ db_appinit(db_home, db_config, dbenv, flags)
return (__db_ferr(dbenv, "db_appinit", 1));
fp = NULL;
- i_lock = i_log = i_mpool = i_txn = 0;
/* Set the database home. */
if ((ret = __db_home(dbenv, db_home, flags)) != 0)
@@ -117,6 +116,7 @@ db_appinit(db_home, db_config, dbenv, flags)
goto err;
}
(void)fclose(fp);
+ fp = NULL;
}
}
@@ -152,34 +152,22 @@ db_appinit(db_home, db_config, dbenv, flags)
#define DB_DEFPERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)
/* Initialize the subsystems. */
- if (LF_ISSET(DB_INIT_LOCK)) {
- if ((ret = lock_open(NULL,
- LF_ISSET(DB_CREATE | DB_THREAD),
- DB_DEFPERM, dbenv, &dbenv->lk_info)) != 0)
- goto err;
- i_lock = 1;
- }
- if (LF_ISSET(DB_INIT_LOG)) {
- if ((ret = log_open(NULL,
- LF_ISSET(DB_CREATE | DB_THREAD),
- DB_DEFPERM, dbenv, &dbenv->lg_info)) != 0)
- goto err;
- i_log = 1;
- }
- if (LF_ISSET(DB_INIT_MPOOL)) {
- if ((ret = memp_open(NULL,
+ if (LF_ISSET(DB_INIT_LOCK) && (ret = lock_open(NULL,
+ LF_ISSET(DB_CREATE | DB_THREAD),
+ DB_DEFPERM, dbenv, &dbenv->lk_info)) != 0)
+ goto err;
+ if (LF_ISSET(DB_INIT_LOG) && (ret = log_open(NULL,
+ LF_ISSET(DB_CREATE | DB_THREAD),
+ DB_DEFPERM, dbenv, &dbenv->lg_info)) != 0)
+ goto err;
+ if (LF_ISSET(DB_INIT_MPOOL) && (ret = memp_open(NULL,
LF_ISSET(DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP | DB_THREAD),
- DB_DEFPERM, dbenv, &dbenv->mp_info)) != 0)
- goto err;
- i_mpool = 1;
- }
- if (LF_ISSET(DB_INIT_TXN)) {
- if ((ret = txn_open(NULL,
- LF_ISSET(DB_CREATE | DB_THREAD | DB_TXN_NOSYNC),
- DB_DEFPERM, dbenv, &dbenv->tx_info)) != 0)
- goto err;
- i_txn = 1;
- }
+ DB_DEFPERM, dbenv, &dbenv->mp_info)) != 0)
+ goto err;
+ if (LF_ISSET(DB_INIT_TXN) && (ret = txn_open(NULL,
+ LF_ISSET(DB_CREATE | DB_THREAD | DB_TXN_NOSYNC),
+ DB_DEFPERM, dbenv, &dbenv->tx_info)) != 0)
+ goto err;
/* Initialize recovery. */
if (LF_ISSET(DB_INIT_TXN)) {
@@ -195,7 +183,7 @@ db_appinit(db_home, db_config, dbenv, flags)
goto err;
}
- /* Now run recovery if necessary. */
+ /* Run recovery if necessary. */
if (LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL) && (ret =
__db_apprec(dbenv, LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL))) != 0)
goto err;
@@ -204,14 +192,6 @@ db_appinit(db_home, db_config, dbenv, flags)
err: if (fp != NULL)
(void)fclose(fp);
- if (i_lock)
- (void)lock_close(dbenv->lk_info);
- if (i_log)
- (void)log_close(dbenv->lg_info);
- if (i_mpool)
- (void)memp_close(dbenv->mp_info);
- if (i_txn)
- (void)txn_close(dbenv->tx_info);
(void)db_appexit(dbenv);
return (ret);
diff --git a/db2/common/db_apprec.c b/db2/common/db_apprec.c
index b22b0c5e9a..2e94673731 100644
--- a/db2/common/db_apprec.c
+++ b/db2/common/db_apprec.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_apprec.c 10.15 (Sleepycat) 7/27/97";
+static const char sccsid[] = "@(#)db_apprec.c 10.16 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -19,6 +19,7 @@ static const char sccsid[] = "@(#)db_apprec.c 10.15 (Sleepycat) 7/27/97";
#include <time.h>
#include <string.h>
+#include <stdlib.h>
#endif
#include "db_int.h"
@@ -30,6 +31,12 @@ static const char sccsid[] = "@(#)db_apprec.c 10.15 (Sleepycat) 7/27/97";
#include "txn.h"
#include "common_ext.h"
+#define FREE_DBT(L, D) { \
+ if (F_ISSET((L), DB_AM_THREAD) && (D).data != NULL) \
+ free((D).data); \
+ (D).data = NULL; \
+ } \
+
/*
* __db_apprec --
* Perform recovery.
@@ -45,30 +52,34 @@ __db_apprec(dbenv, flags)
DB_LOG *lp;
DB_LSN ckp_lsn, first_lsn, lsn, tmp_lsn;
time_t now;
- int first_flag, ret, tret;
+ int first_flag, ret;
void *txninfo;
- ZERO_LSN(ckp_lsn);
-
/* Initialize the transaction list. */
if ((ret = __db_txnlist_init(&txninfo)) != 0)
return (ret);
/*
- * 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 figures this out for us when
- * we pass it the DB_FIRST flag).
+ * 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).
*/
lp = dbenv->lg_info;
if (LF_ISSET(DB_RECOVER_FATAL))
first_flag = DB_FIRST;
- else
- first_flag = __log_findckp(lp, &lsn) != 0 ? DB_FIRST : DB_SET;
+ else {
+ if ((ret = __log_findckp(lp, &lsn)) == DB_NOTFOUND)
+ return (0);
+ first_flag = DB_SET;
+ }
+ /* If we're a threaded application, we have to allocate space. */
memset(&data, 0, sizeof(data));
+ if (F_ISSET(lp, DB_AM_THREAD))
+ F_SET(&data, DB_DBT_MALLOC);
+
if ((ret = log_get(lp, &lsn, &data, first_flag)) != 0) {
__db_err(dbenv, "Failure: unable to get log record");
if (first_flag == DB_SET)
@@ -80,35 +91,55 @@ __db_apprec(dbenv, flags)
}
first_lsn = lsn;
- for (; ret == 0;
- ret = log_get(dbenv->lg_info, &lsn, &data, DB_NEXT))
- if ((tret = __db_dispatch(lp,
- &data, &lsn, TXN_OPENFILES, txninfo)) < 0) {
- ret = tret;
+ for (;;) {
+ ret = __db_dispatch(lp, &data, &lsn, TXN_OPENFILES, txninfo);
+ FREE_DBT(lp, data);
+ 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 err;
+ break;
}
+ }
+ FREE_DBT(lp, data);
+ /*
+ * 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.
+ */
+ ZERO_LSN(ckp_lsn);
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;
- tret =
- __db_dispatch(lp, &data, &lsn, TXN_BACKWARD_ROLL, txninfo);
- if (IS_ZERO_LSN(ckp_lsn) && tret > 0)
- ckp_lsn = tmp_lsn;
- if (tret < 0) {
- ret = tret;
+ ret = __db_dispatch(lp,
+ &data, &lsn, TXN_BACKWARD_ROLL, txninfo);
+ FREE_DBT(lp, data);
+ if (ret == DB_TXN_CKP) {
+ if (IS_ZERO_LSN(ckp_lsn))
+ ckp_lsn = tmp_lsn;
+ ret = 0;
+ } else if (ret != 0)
goto msgerr;
- }
}
+ FREE_DBT(lp, data);
+ if (ret != 0 && ret != DB_NOTFOUND)
+ goto err;
for (ret = log_get(lp, &lsn, &data, DB_NEXT);
- ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT))
- if ((tret = __db_dispatch(lp,
- &data, &lsn, TXN_FORWARD_ROLL, txninfo)) < 0) {
- ret = tret;
+ ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT)) {
+ ret = __db_dispatch(lp, &data, &lsn, TXN_FORWARD_ROLL, txninfo);
+ FREE_DBT(lp, data);
+ if (ret == DB_TXN_CKP)
+ ret = 0;
+ else if (ret != 0)
goto msgerr;
- }
+ }
+ FREE_DBT(lp, data);
+ if (ret != DB_NOTFOUND)
+ goto err;
/* Now close all the db files that are open. */
__log_close_files(lp);
@@ -118,11 +149,11 @@ __db_apprec(dbenv, flags)
* and the current time. Then take a checkpoint.
*/
(void)time(&now);
-
dbenv->tx_info->region->last_txnid = ((__db_txnhead *)txninfo)->maxid;
dbenv->tx_info->region->last_ckp = ckp_lsn;
- dbenv->tx_info->region->time_ckp = (u_int32_t) now;
- txn_checkpoint(dbenv->tx_info, 0, 0);
+ dbenv->tx_info->region->time_ckp = (u_int32_t)now;
+ if ((ret = txn_checkpoint(dbenv->tx_info, 0, 0)) != 0)
+ goto err;
if (dbenv->db_verbose) {
__db_err(lp->dbenv, "Recovery complete at %s", ctime(&now));
@@ -139,5 +170,6 @@ __db_apprec(dbenv, flags)
msgerr: __db_err(dbenv, "Recovery function for LSN %lu %lu failed",
(u_long)lsn.file, (u_long)lsn.offset);
-err: return (ret);
+err: FREE_DBT(lp, data);
+ return (ret);
}
diff --git a/db2/common/db_byteorder.c b/db2/common/db_byteorder.c
index d49883e093..a8d7715455 100644
--- a/db2/common/db_byteorder.c
+++ b/db2/common/db_byteorder.c
@@ -17,6 +17,13 @@ static const char sccsid[] = "@(#)db_byteorder.c 10.3 (Sleepycat) 6/21/97";
#include <errno.h>
#endif
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+# if BYTE_ORDER == BIG_ENDIAN
+# define WORDS_BIGENDIAN 1
+# endif
+#endif
+
#include "db_int.h"
#include "common_ext.h"
diff --git a/db2/common/db_err.c b/db2/common/db_err.c
index 3dc4ca007d..f3e7b40448 100644
--- a/db2/common/db_err.c
+++ b/db2/common/db_err.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_err.c 10.16 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)db_err.c 10.18 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -221,7 +221,7 @@ __db_panic(dbp)
* __db_fchk --
* General flags checking routine.
*
- * PUBLIC: int __db_fchk __P((DB_ENV *, char *, int, int));
+ * PUBLIC: int __db_fchk __P((DB_ENV *, const char *, int, int));
*/
int
__db_fchk(dbenv, name, flags, ok_flags)
@@ -237,7 +237,7 @@ __db_fchk(dbenv, name, flags, ok_flags)
* __db_fcchk --
* General combination flags checking routine.
*
- * PUBLIC: int __db_fcchk __P((DB_ENV *, char *, int, int, int));
+ * PUBLIC: int __db_fcchk __P((DB_ENV *, const char *, int, int, int));
*/
int
__db_fcchk(dbenv, name, flags, flag1, flag2)
@@ -521,7 +521,7 @@ __db_syncchk(dbp, flags)
* __db_ferr --
* Common flag errors.
*
- * PUBLIC: int __db_ferr __P((const DB_ENV *, char *, int));
+ * PUBLIC: int __db_ferr __P((const DB_ENV *, const char *, int));
*/
int
__db_ferr(dbenv, name, combo)
diff --git a/db2/common/db_region.c b/db2/common/db_region.c
index 51f8f4465c..86d79a8148 100644
--- a/db2/common/db_region.c
+++ b/db2/common/db_region.c
@@ -43,7 +43,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_region.c 10.12 (Sleepycat) 7/26/97";
+static const char sccsid[] = "@(#)db_region.c 10.13 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -229,7 +229,7 @@ __db_ropen(dbenv, appname, path, file, flags, fdp, retp)
goto err2;
/* Check to make sure the first block has been written. */
- if ((size_t) size1 < sizeof(RLAYOUT)) {
+ if ((size_t)size1 < sizeof(RLAYOUT)) {
ret = EAGAIN;
goto err2;
}
diff --git a/db2/config.h b/db2/config.h
index ed1246d0f4..27dbdaa439 100644
--- a/db2/config.h
+++ b/db2/config.h
@@ -2,7 +2,6 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* ...but edited by hand to be used in GNU libc. */
-#include <endian.h>
#include <sys/stat.h> /* To get _STATBUF_ST_BLKSIZE. */
/* Define to empty if the keyword does not work. */
@@ -28,11 +27,8 @@
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
-/* Define if your processor stores words with the most significant
- byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#if __BYTE_ORDER == BIG_ENDIAN
-# define WORDS_BIGENDIAN 1
-#endif
+/* Say we have endian.h. */
+#define HAVE_ENDIAN_H 1
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef ssize_t */
diff --git a/db2/db.h b/db2/db.h
index 3769579c58..c80d8e3633 100644
--- a/db2/db.h
+++ b/db2/db.h
@@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db.h.src 10.67 (Sleepycat) 8/25/97
+ * @(#)db.h.src 10.71 (Sleepycat) 9/4/97
*/
#ifndef _DB_H_
@@ -67,8 +67,8 @@
#define DB_VERSION_MAJOR 2
#define DB_VERSION_MINOR 3
-#define DB_VERSION_PATCH 4
-#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.4: (8/20/97)"
+#define DB_VERSION_PATCH 6
+#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.6: (9/4/97)"
typedef u_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset type. */
@@ -329,6 +329,7 @@ struct __db_info {
#define DB_NEEDSPLIT ( -9) /* Page needs to be split. */
#define DB_REGISTERED (-10) /* Entry was previously registered. */
#define DB_SWAPBYTES (-11) /* Database needs byte swapping. */
+#define DB_TXN_CKP (-12) /* Encountered ckp record in log. */
struct __db_ilock { /* Internal DB access method lock. */
db_pgno_t pgno; /* Page being locked. */
@@ -479,7 +480,7 @@ extern "C" {
int db_appinit __P((const char *, char * const *, DB_ENV *, int));
int db_appexit __P((DB_ENV *));
int db_open __P((const char *, DBTYPE, int, int, DB_ENV *, DB_INFO *, DB **));
-const char *db_version __P((int *, int *, int *));
+char *db_version __P((int *, int *, int *));
#if defined(__cplusplus)
};
#endif
diff --git a/db2/db/db.c b/db2/db/db.c
index df3a9d2d21..8dad5febe8 100644
--- a/db2/db/db.c
+++ b/db2/db/db.c
@@ -44,7 +44,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db.c 10.37 (Sleepycat) 8/23/97";
+static const char sccsid[] = "@(#)db.c 10.38 (Sleepycat) 9/2/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -248,9 +248,6 @@ db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp)
* that fail, we simply retry without the O_CREAT flag, which
* will require that the meta-data page exist.
*/
-#undef OKFLAGS
-#define OKFLAGS \
- DB_CREATE | DB_NOMMAP | DB_RDONLY | DB_THREAD | DB_TRUNCATE
retry_cnt = 0;
open_retry: if (LF_ISSET(DB_CREATE)) {
if ((ret = __db_fdopen(real_name, flags | DB_EXCL,
@@ -308,13 +305,20 @@ open_retry: if (LF_ISSET(DB_CREATE)) {
}
/*
* The only way we can reach here with the DB_CREATE
- * flag set is if we created the file. If we didn't
- * create the file, there's a chance that someone else
- * is busily doing so. Sleep and give them a chance,
- * because we need the metadata page their going to
- * write.
+ * flag set is if we created the file. If that's not
+ * the case, then a) someone else created the file
+ * but has not yet written out the meta-data page, or
+ * b) we truncated the file (DB_TRUNCATE) leaving it
+ * zero-length. In the case of a), we want to sleep
+ * and give the file creator some time to write the
+ * metadata page. In the case of b), charge forward.
+ * Note, there is a race in the case of two processes
+ * opening the file with the DB_TRUNCATE flag set at
+ * roughly the same time, and they could theoretically
+ * hurt each other, although it's pretty unlikely.
*/
- if (!LF_ISSET(DB_CREATE) && retry_cnt++ < 3) {
+ if (retry_cnt++ < 3 &&
+ !LF_ISSET(DB_CREATE | DB_TRUNCATE)) {
__db_sleep(1, 0);
goto open_retry;
}
diff --git a/db2/db/db_conv.c b/db2/db/db_conv.c
index 39527c6804..6608005b66 100644
--- a/db2/db/db_conv.c
+++ b/db2/db/db_conv.c
@@ -44,7 +44,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_conv.c 10.4 (Sleepycat) 8/15/97";
+static const char sccsid[] = "@(#)db_conv.c 10.5 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -145,7 +145,7 @@ __db_convert(pg, pp, pgin)
M_16_SWAP(h->inp[i]);
bk = GET_BKEYDATA(h, i);
- switch (bk->type) {
+ switch (B_TYPE(bk->type)) {
case B_KEYDATA:
M_16_SWAP(bk->len);
break;
@@ -167,7 +167,7 @@ __db_convert(pg, pp, pgin)
M_16_SWAP(h->inp[i]);
bi = GET_BINTERNAL(h, i);
- switch (bi->type) {
+ switch (B_TYPE(bi->type)) {
case B_KEYDATA:
M_16_SWAP(bi->len);
M_32_SWAP(bi->pgno);
diff --git a/db2/db/db_dup.c b/db2/db/db_dup.c
index 8d364d518e..66c6c2616a 100644
--- a/db2/db/db_dup.c
+++ b/db2/db/db_dup.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_dup.c 10.8 (Sleepycat) 7/20/97";
+static const char sccsid[] = "@(#)db_dup.c 10.9 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -65,8 +65,7 @@ __db_dput(dbp, dbt, pp, indxp, newfunc)
if (dbt->size > 0.25 * dbp->pgsize) {
if ((ret = __db_poff(dbp, dbt, &pgno, newfunc)) != 0)
return (ret);
- bo.deleted = 0;
- bo.type = B_OVERFLOW;
+ B_TSET(bo.type, B_OVERFLOW, 0);
bo.tlen = dbt->size;
bo.pgno = pgno;
hdr_dbt.data = &bo;
@@ -125,7 +124,7 @@ __db_drem(dbp, pp, indx, freefunc)
pagep = *pp;
/* Check if we are freeing a big item. */
- if (GET_BKEYDATA(pagep, indx)->type == B_OVERFLOW) {
+ if (B_TYPE(GET_BKEYDATA(pagep, indx)->type) == B_OVERFLOW) {
if ((ret = __db_doff(dbp,
GET_BOVERFLOW(pagep, indx)->pgno, freefunc)) != 0)
return (ret);
@@ -255,7 +254,7 @@ __db_dsplit(dbp, hp, indxp, size, newfunc)
lastsum = sum;
did_indx = 1;
}
- if (GET_BKEYDATA(h, i)->type == B_KEYDATA)
+ if (B_TYPE(GET_BKEYDATA(h, i)->type) == B_KEYDATA)
sum += BKEYDATA_SIZE(GET_BKEYDATA(h, i)->len);
else
sum += BOVERFLOW_SIZE;
@@ -300,7 +299,7 @@ __db_dsplit(dbp, hp, indxp, size, newfunc)
for (nindex = 0, oindex = i + 1; oindex < NUM_ENT(h); oindex++) {
bk = GET_BKEYDATA(h, oindex);
- if (bk->type == B_KEYDATA)
+ if (B_TYPE(bk->type) == B_KEYDATA)
s = BKEYDATA_SIZE(bk->len);
else
s = BOVERFLOW_SIZE;
@@ -316,7 +315,7 @@ __db_dsplit(dbp, hp, indxp, size, newfunc)
*/
for (nindex = 0, oindex = 0; oindex <= i; oindex++) {
bk = GET_BKEYDATA(h, oindex);
- if (bk->type == B_KEYDATA)
+ if (B_TYPE(bk->type) == B_KEYDATA)
s = BKEYDATA_SIZE(bk->len);
else
s = BOVERFLOW_SIZE;
@@ -474,8 +473,7 @@ __db_pitem(dbp, pagep, indx, nbytes, hdr, data)
return (ret);
if (hdr == NULL) {
- bk.deleted = 0;
- bk.type = B_KEYDATA;
+ B_TSET(bk.type, B_KEYDATA, 0);
bk.len = data == NULL ? 0 : data->size;
thdr.data = &bk;
diff --git a/db2/db/db_pr.c b/db2/db/db_pr.c
index c103b10e4f..f86fd6770a 100644
--- a/db2/db/db_pr.c
+++ b/db2/db/db_pr.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_pr.c 10.14 (Sleepycat) 8/17/97";
+static const char sccsid[] = "@(#)db_pr.c 10.16 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -461,12 +461,12 @@ __db_prpage(h, all)
case P_LBTREE:
bk = GET_BKEYDATA(h, i);
deleted = i % 2 == 0 &&
- GET_BKEYDATA(h, i + O_INDX)->deleted;
+ B_DISSET(GET_BKEYDATA(h, i + O_INDX)->type);
break;
case P_LRECNO:
case P_DUPLICATE:
bk = GET_BKEYDATA(h, i);
- deleted = GET_BKEYDATA(h, i)->deleted;
+ deleted = B_DISSET(GET_BKEYDATA(h, i)->type);
break;
default:
fprintf(fp,
@@ -525,7 +525,7 @@ __db_prpage(h, all)
case P_IBTREE:
fprintf(fp, "count: %4lu pgno: %4lu ",
(u_long)bi->nrecs, (u_long)bi->pgno);
- switch (bi->type) {
+ switch (B_TYPE(bi->type)) {
case B_KEYDATA:
__db_pr(bi->data, bi->len);
break;
@@ -535,7 +535,7 @@ __db_prpage(h, all)
break;
default:
fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n",
- (u_long)bi->type);
+ (u_long)B_TYPE(bi->type));
ret = EINVAL;
break;
}
@@ -547,7 +547,7 @@ __db_prpage(h, all)
case P_LBTREE:
case P_LRECNO:
case P_DUPLICATE:
- switch (bk->type) {
+ switch (B_TYPE(bk->type)) {
case B_KEYDATA:
__db_pr(bk->data, bk->len);
break;
@@ -558,7 +558,7 @@ __db_prpage(h, all)
default:
fprintf(fp,
"ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n",
- (u_long)bk->type);
+ (u_long)B_TYPE(bk->type));
ret = EINVAL;
break;
}
@@ -630,11 +630,11 @@ __db_isbad(h, die)
break;
case P_IBTREE:
bi = GET_BINTERNAL(h, i);
- if (bi->type != B_KEYDATA &&
- bi->type != B_DUPLICATE &&
- bi->type != B_OVERFLOW) {
+ if (B_TYPE(bi->type) != B_KEYDATA &&
+ B_TYPE(bi->type) != B_DUPLICATE &&
+ B_TYPE(bi->type) != B_OVERFLOW) {
fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n",
- (u_long)bi->type);
+ (u_long)B_TYPE(bi->type));
goto bad;
}
break;
@@ -644,12 +644,12 @@ __db_isbad(h, die)
break;
case P_DUPLICATE:
bk = GET_BKEYDATA(h, i);
- if (bk->type != B_KEYDATA &&
- bk->type != B_DUPLICATE &&
- bk->type != B_OVERFLOW) {
+ if (B_TYPE(bk->type) != B_KEYDATA &&
+ B_TYPE(bk->type) != B_DUPLICATE &&
+ B_TYPE(bk->type) != B_OVERFLOW) {
fprintf(fp,
"ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n",
- (u_long)bk->type);
+ (u_long)B_TYPE(bk->type));
goto bad;
}
break;
@@ -713,18 +713,18 @@ __db_proff(vp)
void *vp;
{
FILE *fp;
- BOVERFLOW *p;
+ BOVERFLOW *bo;
fp = __db_prinit(NULL);
- p = vp;
- switch (p->type) {
+ bo = vp;
+ switch (B_TYPE(bo->type)) {
case B_OVERFLOW:
fprintf(fp, "overflow: total len: %4lu page: %4lu\n",
- (u_long)p->tlen, (u_long)p->pgno);
+ (u_long)bo->tlen, (u_long)bo->pgno);
break;
case B_DUPLICATE:
- fprintf(fp, "duplicate: page: %4lu\n", (u_long)p->pgno);
+ fprintf(fp, "duplicate: page: %4lu\n", (u_long)bo->pgno);
break;
}
}
diff --git a/db2/db/db_ret.c b/db2/db/db_ret.c
index ddeb26eb94..baf0665446 100644
--- a/db2/db/db_ret.c
+++ b/db2/db/db_ret.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_ret.c 10.5 (Sleepycat) 7/12/97";
+static const char sccsid[] = "@(#)db_ret.c 10.6 (Sleepycat) 9/3/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -63,7 +63,7 @@ __db_ret(dbp, h, indx, dbt, memp, memsize)
case P_LBTREE:
case P_LRECNO:
bk = GET_BKEYDATA(h, indx);
- if (bk->type == B_OVERFLOW) {
+ if (B_TYPE(bk->type) == B_OVERFLOW) {
bo = (BOVERFLOW *)bk;
return (__db_goff(dbp, dbt,
bo->tlen, bo->pgno, memp, memsize));
diff --git a/db2/db185/db185.c b/db2/db185/db185.c
index 933f55c813..8e53a1b734 100644
--- a/db2/db185/db185.c
+++ b/db2/db185/db185.c
@@ -38,7 +38,7 @@ static int db185_seq __P((const DB185 *, DBT185 *, DBT185 *, u_int));
static int db185_sync __P((const DB185 *, u_int));
DB185 *
-__dbopen(file, oflags, mode, type, openinfo)
+dbopen(file, oflags, mode, type, openinfo)
const char *file;
int oflags, mode;
DBTYPE type;
@@ -203,7 +203,6 @@ einval: free(db185p);
errno = EINVAL;
return (NULL);
}
-weak_alias (__dbopen, dbopen)
static int
db185_close(db185p)
diff --git a/db2/dbm/dbm.c b/db2/dbm/dbm.c
index 8daa980f5a..fb21ade020 100644
--- a/db2/dbm/dbm.c
+++ b/db2/dbm/dbm.c
@@ -47,7 +47,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)dbm.c 10.5 (Sleepycat) 7/19/97";
+static const char sccsid[] = "@(#)dbm.c 10.6 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -65,6 +65,12 @@ static const char sccsid[] = "@(#)dbm.c 10.5 (Sleepycat) 7/19/97";
#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.
@@ -75,12 +81,6 @@ static DBM *__cur_db;
static void __db_no_open __P((void));
-/* Provide prototypes here since there are none in db.h. */
-int dbm_error __P((DBM *));
-int dbm_clearerr __P((DBM *));
-int dbm_dirfno __P((DBM *));
-int dbm_pagfno __P((DBM *));
-
int
dbminit(file)
char *file;
diff --git a/db2/hash/hash_dup.c b/db2/hash/hash_dup.c
index 059eec6f92..c9590fa49d 100644
--- a/db2/hash/hash_dup.c
+++ b/db2/hash/hash_dup.c
@@ -42,7 +42,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)hash_dup.c 10.5 (Sleepycat) 7/27/97";
+static const char sccsid[] = "@(#)hash_dup.c 10.6 (Sleepycat) 9/3/97";
#endif /* not lint */
/*
@@ -277,8 +277,7 @@ __ham_dup_convert(hashp, hcp)
dndx = 0;
memcpy(&ho,
P_ENTRY(hcp->pagep, H_DATAINDEX(hcp->bndx)), HOFFPAGE_SIZE);
- bo.deleted = 0;
- bo.type = ho.type;
+ B_TSET(bo.type, ho.type, 0);
bo.pgno = ho.pgno;
bo.tlen = ho.tlen;
dbt.size = BOVERFLOW_SIZE;
diff --git a/db2/include/db_am.h b/db2/include/db_am.h
index 3289eececa..5814ff88c3 100644
--- a/db2/include/db_am.h
+++ b/db2/include/db_am.h
@@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_am.h 10.5 (Sleepycat) 8/22/97
+ * @(#)db_am.h 10.6 (Sleepycat) 8/27/97
*/
#ifndef _DB_AM_H
#define _DB_AM_H
@@ -30,7 +30,7 @@
file_dbp = mdbp = NULL; \
if ((ret = func(dbtp->data, &argp)) != 0) \
goto out; \
- if (__db_fileid_to_db(logp, &mdbp, argp->fileid)) { \
+ if ((ret = __db_fileid_to_db(logp, &mdbp, argp->fileid)) != 0) {\
if (ret == DB_DELETED) \
ret = 0; \
goto out; \
diff --git a/db2/include/db_page.h b/db2/include/db_page.h
index 9e78682c57..cde7ff9f2e 100644
--- a/db2/include/db_page.h
+++ b/db2/include/db_page.h
@@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_page.h 10.10 (Sleepycat) 8/18/97
+ * @(#)db_page.h 10.11 (Sleepycat) 9/3/97
*/
#ifndef _DB_PAGE_H_
@@ -400,6 +400,24 @@ typedef struct _hoffdup {
#define B_OVERFLOW 3 /* Overflow key/data item. */
/*
+ * We have to store a deleted entry flag in the page. The reason is complex,
+ * but the simple version is that we can't delete on-page items referenced by
+ * a cursor -- the return order of subsequent insertions might be wrong. The
+ * delete flag is an overload of the top bit of the type byte.
+ */
+#define B_DELETE (0x80)
+#define B_DCLR(t) (t) &= ~B_DELETE
+#define B_DSET(t) (t) |= B_DELETE
+#define B_DISSET(t) ((t) & B_DELETE)
+
+#define B_TYPE(t) ((t) & ~B_DELETE)
+#define B_TSET(t, type, deleted) { \
+ (t) = (type); \
+ if (deleted) \
+ B_DSET(t); \
+}
+
+/*
* The first type is B_KEYDATA, represented by the BKEYDATA structure:
*
* +-----------------------------------+
@@ -408,8 +426,7 @@ typedef struct _hoffdup {
*/
typedef struct _bkeydata {
db_indx_t len; /* 00-01: Key/data item length. */
- u_int deleted :1; /* 02: Page type and delete flag. */
- u_int type :7;
+ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int8_t data[1]; /* Variable length key/data item. */
} BKEYDATA;
@@ -438,8 +455,7 @@ typedef struct _bkeydata {
*/
typedef struct _boverflow {
db_indx_t unused1; /* 00-01: Padding, unused. */
- u_int deleted :1; /* 02: Page type and delete flag. */
- u_int type :7;
+ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int8_t unused2; /* 03: Padding, unused. */
db_pgno_t pgno; /* 04-07: Next page number. */
u_int32_t tlen; /* 08-11: Total length of item. */
@@ -479,9 +495,8 @@ typedef struct _boverflow {
* +-----------------------------------+
*/
typedef struct _binternal {
- db_indx_t len; /* 00-01: Key/data item length. */
- u_int deleted :1; /* 02: Page type and delete flag. */
- u_int type :7;
+ db_indx_t len; /* 00-01: Key/data item length. */
+ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int8_t unused; /* 03: Padding, unused. */
db_pgno_t pgno; /* 04-07: Page number of referenced page. */
db_recno_t nrecs; /* 08-11: Subtree record count. */
diff --git a/db2/include/mp.h b/db2/include/mp.h
index 4872596f83..1fe0c752a9 100644
--- a/db2/include/mp.h
+++ b/db2/include/mp.h
@@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)mp.h 10.14 (Sleepycat) 8/18/97
+ * @(#)mp.h 10.15 (Sleepycat) 8/29/97
*/
struct __bh; typedef struct __bh BH;
@@ -161,9 +161,12 @@ struct __db_mpoolfile {
void *addr; /* Address of mmap'd region. */
size_t len; /* Length of mmap'd region. */
-#define MP_PATH_ALLOC 0x01 /* Path is allocated memory. */
-#define MP_PATH_TEMP 0x02 /* Backing file is a temporary. */
-#define MP_READONLY 0x04 /* File is readonly. */
+/* These fields need to be protected for multi-threaded support. */
+#define MP_PATH_ALLOC 0x001 /* Path is allocated memory. */
+#define MP_PATH_TEMP 0x002 /* Backing file is a temporary. */
+#define MP_READONLY 0x004 /* File is readonly. */
+#define MP_UPGRADE 0x008 /* File descriptor is readwrite. */
+#define MP_UPGRADE_FAIL 0x010 /* Upgrade wasn't possible. */
u_int32_t flags;
};
diff --git a/db2/log/log.c b/db2/log/log.c
index 1684ce8cc8..d3e5183588 100644
--- a/db2/log/log.c
+++ b/db2/log/log.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log.c 10.24 (Sleepycat) 8/16/97";
+static const char sccsid[] = "@(#)log.c 10.25 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
diff --git a/db2/log/log_findckp.c b/db2/log/log_findckp.c
index 67fe9c9f50..df75e20e03 100644
--- a/db2/log/log_findckp.c
+++ b/db2/log/log_findckp.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_findckp.c 10.10 (Sleepycat) 7/30/97";
+static const char sccsid[] = "@(#)log_findckp.c 10.11 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -119,7 +119,7 @@ __log_findckp(lp, lsnp)
return (ret);
if (F_ISSET(lp, DB_AM_THREAD))
free(data.data);
- }
+ }
*lsnp = last_ckp;
if (verbose)
diff --git a/db2/log/log_get.c b/db2/log/log_get.c
index 37eb5cb249..54a58c75fc 100644
--- a/db2/log/log_get.c
+++ b/db2/log/log_get.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_get.c 10.16 (Sleepycat) 8/19/97";
+static const char sccsid[] = "@(#)log_get.c 10.17 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -115,8 +115,8 @@ __log_get(dblp, alsn, dbt, flags, silent)
size_t len;
ssize_t nr;
int cnt, ret;
- const char *fail;
char *np, *tbuf;
+ const char *fail;
void *p, *shortp;
lp = dblp->lp;
diff --git a/db2/log/log_rec.c b/db2/log/log_rec.c
index dbc5960731..f49a7f16ea 100644
--- a/db2/log/log_rec.c
+++ b/db2/log/log_rec.c
@@ -40,7 +40,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_rec.c 10.11 (Sleepycat) 8/20/97";
+static const char sccsid[] = "@(#)log_rec.c 10.13 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -59,7 +59,7 @@ static const char sccsid[] = "@(#)log_rec.c 10.11 (Sleepycat) 8/20/97";
#include "db_dispatch.h"
#include "common_ext.h"
-static int __log_open_file __P((DB_LOG *,
+static int __log_open_file __P((DB_LOG *,
u_int8_t *, char *, DBTYPE, u_int32_t));
/*
@@ -132,10 +132,16 @@ __log_unregister_recover(logp, dbtp, lsnp, redo, info)
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)
- ret = EINVAL;
- else if (--logp->dbentry[argp->id].refcount == 0) {
+ 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;
diff --git a/db2/mp/mp_bh.c b/db2/mp/mp_bh.c
index e1b68ce450..3d0d053b5f 100644
--- a/db2/mp/mp_bh.c
+++ b/db2/mp/mp_bh.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_bh.c 10.12 (Sleepycat) 8/20/97";
+static const char sccsid[] = "@(#)mp_bh.c 10.15 (Sleepycat) 8/29/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -24,6 +24,8 @@ static const char sccsid[] = "@(#)mp_bh.c 10.12 (Sleepycat) 8/20/97";
#include "mp.h"
#include "common_ext.h"
+static int __memp_upgrade __P((DB_MPOOL *, DB_MPOOLFILE *, MPOOLFILE *));
+
/*
* __memp_bhwrite --
* Write the page associated with a given bucket header.
@@ -48,14 +50,20 @@ __memp_bhwrite(dbmp, mfp, bhp, restartp, wrotep)
*wrotep = 0;
/*
- * Walk the process' DB_MPOOLFILE list and try and find a file
- * descriptor for this file.
+ * Walk the process' DB_MPOOLFILE list and find a file descriptor for
+ * the file. We also check that the descriptor is open for writing.
+ * If we find a descriptor on the file that's not open for writing, we
+ * try and upgrade it to make it writeable.
*/
LOCKHANDLE(dbmp, &dbmp->mutex);
for (dbmfp = TAILQ_FIRST(&dbmp->dbmfq);
dbmfp != NULL; dbmfp = TAILQ_NEXT(dbmfp, q))
- if (dbmfp->mfp == mfp)
+ if (dbmfp->mfp == mfp) {
+ if (F_ISSET(dbmfp, MP_READONLY) &&
+ __memp_upgrade(dbmp, dbmfp, mfp))
+ return (0);
break;
+ }
UNLOCKHANDLE(dbmp, &dbmp->mutex);
if (dbmfp != NULL)
goto found;
@@ -80,6 +88,10 @@ __memp_bhwrite(dbmp, mfp, bhp, restartp, wrotep)
/*
* Try and open the file; ignore any error, assume it's a permissions
* problem.
+ *
+ * XXX
+ * There's no negative cache here, so we may repeatedly try and open
+ * files that we have previously tried (and failed) to open.
*/
dbt.size = mfp->pgcookie_len;
dbt.data = ADDR(dbmp, mfp->pgcookie_off);
@@ -435,3 +447,42 @@ __memp_bhfree(dbmp, mfp, bhp, free_mem)
if (free_mem)
__db_shalloc_free(dbmp->addr, bhp);
}
+
+/*
+ * __memp_upgrade --
+ * Upgrade a file descriptor from readonly to readwrite.
+ */
+static int
+__memp_upgrade(dbmp, dbmfp, mfp)
+ DB_MPOOL *dbmp;
+ DB_MPOOLFILE *dbmfp;
+ MPOOLFILE *mfp;
+{
+ int fd;
+
+ /*
+ * !!!
+ * We expect the handle to already be locked.
+ */
+
+ /* Check to see if we've already upgraded. */
+ if (F_ISSET(dbmfp, MP_UPGRADE))
+ return (0);
+
+ /* Check to see if we've already failed. */
+ if (F_ISSET(dbmfp, MP_UPGRADE_FAIL))
+ return (1);
+
+ /* Try the open. */
+ if (__db_fdopen(ADDR(dbmp, mfp->path_off), 0, 0, 0, &fd) != 0) {
+ F_SET(dbmfp, MP_UPGRADE_FAIL);
+ return (1);
+ }
+
+ /* Swap the descriptors and set the upgrade flag. */
+ (void)close(dbmfp->fd);
+ dbmfp->fd = fd;
+ F_SET(dbmfp, MP_UPGRADE);
+
+ return (0);
+}
diff --git a/db2/mp/mp_fopen.c b/db2/mp/mp_fopen.c
index 7703847b73..1a770bfdf0 100644
--- a/db2/mp/mp_fopen.c
+++ b/db2/mp/mp_fopen.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_fopen.c 10.24 (Sleepycat) 8/20/97";
+static const char sccsid[] = "@(#)mp_fopen.c 10.25 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -110,7 +110,7 @@ __memp_fopen(dbmp, path,
ret = EINVAL;
goto err;
}
- dbmfp->path = (char *) TEMPORARY;
+ dbmfp->path = (char *)TEMPORARY;
F_SET(dbmfp, MP_PATH_TEMP);
} else {
/* Calculate the real name for this file. */
diff --git a/db2/mp/mp_pr.c b/db2/mp/mp_pr.c
index 94eabf5947..7794cfa7f3 100644
--- a/db2/mp/mp_pr.c
+++ b/db2/mp/mp_pr.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_pr.c 10.12 (Sleepycat) 7/29/97";
+static const char sccsid[] = "@(#)mp_pr.c 10.13 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
diff --git a/db2/mp/mp_sync.c b/db2/mp/mp_sync.c
index 4f1205661a..65b2a18267 100644
--- a/db2/mp/mp_sync.c
+++ b/db2/mp/mp_sync.c
@@ -7,7 +7,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mp_sync.c 10.8 (Sleepycat) 7/2/97";
+static const char sccsid[] = "@(#)mp_sync.c 10.9 (Sleepycat) 8/29/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -167,8 +167,12 @@ memp_fsync(dbmfp)
size_t mf_offset;
int pincnt, restart, ret, wrote;
- /* We don't sync temporary files -- what's the use? */
- if (F_ISSET(dbmfp, MP_PATH_TEMP))
+ /*
+ * If this handle doesn't have a file descriptor that's open for
+ * writing, or if the file is a temporary, there's no reason to
+ * proceed further.
+ */
+ if (F_ISSET(dbmfp, MP_READONLY | MP_PATH_TEMP))
return (0);
dbmp = dbmfp->dbmp;
@@ -199,7 +203,7 @@ retry: pincnt = 0;
goto retry;
}
- UNLOCKREGION(dbmp);
+err: UNLOCKREGION(dbmp);
-err: return (ret == 0 ? (pincnt ? DB_INCOMPLETE : 0) : ret);
+ return (ret == 0 ? (pincnt ? DB_INCOMPLETE : 0) : ret);
}
diff --git a/db2/mutex/x86.gcc b/db2/mutex/x86.gcc
index 886a6811a2..566b9c4433 100644
--- a/db2/mutex/x86.gcc
+++ b/db2/mutex/x86.gcc
@@ -1,12 +1,12 @@
/*
- * @(#)x86.gcc 10.2 (Sleepycat) 6/21/97
+ * @(#)x86.gcc 10.3 (Sleepycat) 8/27/97
*
* For gcc/x86, 0 is clear, 1 is set.
*/
#define TSL_SET(tsl) ({ \
register tsl_t *__l = (tsl); \
int __r; \
- asm volatile("movl $1,%%eax; xchgb %1,%%al; xorl $1,%%eax" \
+ asm volatile("movl $1,%%eax; lock; xchgb %1,%%al; xorl $1,%%eax"\
: "=&a" (__r), "=m" (*__l) \
: "1" (*__l) \
); \
diff --git a/db2/os/db_os_dir.c b/db2/os/db_os_dir.c
index 23a6a45919..6dabd62049 100644
--- a/db2/os/db_os_dir.c
+++ b/db2/os/db_os_dir.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_os_dir.c 10.7 (Sleepycat) 8/23/97";
+static const char sccsid[] = "@(#)db_os_dir.c 10.8 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -45,7 +45,7 @@ static const char sccsid[] = "@(#)db_os_dir.c 10.7 (Sleepycat) 8/23/97";
* __db_dir --
* Return a list of the files in a directory.
*
- * PUBLIC: int __db_dir __P((DB_ENV *, char *, char ***, int *));
+ * PUBLIC: int __db_dir __P((DB_ENV *, const char *, char ***, int *));
*/
int
__db_dir(dbenv, dir, namesp, cntp)
@@ -61,7 +61,7 @@ __db_dir(dbenv, dir, namesp, cntp)
long dirhandle;
int finished;
- if ((dirhandle = _findfirst(dir,&fdata)) == -1) {
+ if ((dirhandle = _findfirst(dir, &fdata)) == -1) {
__db_err(dbenv, "%s: %s", dir, strerror(errno));
return (errno);
}
diff --git a/db2/os/db_os_fid.c b/db2/os/db_os_fid.c
index 8fa55fa56c..960d580bad 100644
--- a/db2/os/db_os_fid.c
+++ b/db2/os/db_os_fid.c
@@ -8,7 +8,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)db_os_fid.c 10.7 (Sleepycat) 8/21/97";
+static const char sccsid[] = "@(#)db_os_fid.c 10.8 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -39,9 +39,9 @@ __db_fileid(dbenv, fname, timestamp, fidp)
int timestamp;
u_int8_t *fidp;
{
+ size_t i;
time_t now;
u_int8_t *p;
- unsigned int i;
#ifdef _WIN32
/*
diff --git a/db2/progs/db_archive/db_archive.c b/db2/progs/db_archive/db_archive.c
index 136cf2c360..a9c6c28e70 100644
--- a/db2/progs/db_archive/db_archive.c
+++ b/db2/progs/db_archive/db_archive.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_archive.c 10.12 (Sleepycat) 7/25/97";
+static const char sccsid[] = "@(#)db_archive.c 10.15 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -34,12 +34,13 @@ static const char sccsid[] = "@(#)db_archive.c 10.12 (Sleepycat) 7/25/97";
DB_ENV *db_init __P((char *, int));
void onint __P((int));
+int main __P((int, char *[]));
void siginit __P((void));
void usage __P((void));
-int main __P((int, char *[]));
int interrupted;
-const char *progname = "db_archive"; /* Program name. */
+const char
+ *progname = "db_archive"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_checkpoint/db_checkpoint.c b/db2/progs/db_checkpoint/db_checkpoint.c
index 586b4b9686..4f9b79a7ba 100644
--- a/db2/progs/db_checkpoint/db_checkpoint.c
+++ b/db2/progs/db_checkpoint/db_checkpoint.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_checkpoint.c 10.9 (Sleepycat) 7/4/97";
+static const char sccsid[] = "@(#)db_checkpoint.c 10.11 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -39,14 +39,15 @@ char *check __P((DB_ENV *, long, long));
int checkpoint __P((DB_ENV *, char *, int));
DB_ENV *db_init __P((char *));
int logpid __P((char *, int));
+int main __P((int, char *[]));
void onint __P((int));
void siginit __P((void));
void usage __P((void));
-int main __P((int, char *[]));
int interrupted;
time_t now; /* Checkpoint time. */
-const char *progname = "db_checkpoint"; /* Program name. */
+const char
+ *progname = "db_checkpoint"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_deadlock/db_deadlock.c b/db2/progs/db_deadlock/db_deadlock.c
index 9437e3552d..09004f58b3 100644
--- a/db2/progs/db_deadlock/db_deadlock.c
+++ b/db2/progs/db_deadlock/db_deadlock.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_deadlock.c 10.13 (Sleepycat) 7/20/97";
+static const char sccsid[] = "@(#)db_deadlock.c 10.14 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -33,14 +33,15 @@ static const char sccsid[] = "@(#)db_deadlock.c 10.13 (Sleepycat) 7/20/97";
#define BAD_KILLID 0xffffffff
DB_ENV *db_init __P((char *, int));
+int logpid __P((char *, int));
+int main __P((int, char *[]));
void onint __P((int));
void siginit __P((void));
void usage __P((void));
-int logpid __P((char *, int));
-int main __P((int, char *[]));
int interrupted;
-const char *progname = "db_deadlock"; /* Program name. */
+const char
+ *progname = "db_deadlock"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_dump/db_dump.c b/db2/progs/db_dump/db_dump.c
index d60aa9b5c9..a0f60c69a6 100644
--- a/db2/progs/db_dump/db_dump.c
+++ b/db2/progs/db_dump/db_dump.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_dump.c 10.13 (Sleepycat) 8/19/97";
+static const char sccsid[] = "@(#)db_dump.c 10.16 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -19,10 +19,10 @@ static const char sccsid[] = "@(#)db_dump.c 10.13 (Sleepycat) 8/19/97";
#include <ctype.h>
#include <errno.h>
-#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#endif
#include "db_int.h"
@@ -35,11 +35,12 @@ void configure __P((char *));
DB_ENV *db_init __P((char *));
void dbt_dump __P((DBT *));
void dbt_print __P((DBT *));
+int main __P((int, char *[]));
void pheader __P((DB *, int));
void usage __P((void));
-int main __P((int, char *[]));
-const char *progname = "db_dump"; /* Program name. */
+const char
+ *progname = "db_dump"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_dump185/db_dump185.c b/db2/progs/db_dump185/db_dump185.c
index f3c1187e45..6e2d95bee0 100644
--- a/db2/progs/db_dump185/db_dump185.c
+++ b/db2/progs/db_dump185/db_dump185.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_dump185.c 10.5 (Sleepycat) 7/2/97";
+static const char sccsid[] = "@(#)db_dump185.c 10.7 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -20,10 +20,10 @@ static const char sccsid[] = "@(#)db_dump185.c 10.5 (Sleepycat) 7/2/97";
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#endif
#include "db_185.h"
@@ -149,14 +149,15 @@ typedef struct _btree {
u_int32_t flags;
} BTREE;
-void db_185_btree __P((DB *, int));
-void db_185_hash __P((DB *, int));
-void dbt_dump __P((DBT *));
-void dbt_print __P((DBT *));
-void usage __P((void));
-int main __P((int, char *[]));
+void db_185_btree __P((DB *, int));
+void db_185_hash __P((DB *, int));
+void dbt_dump __P((DBT *));
+void dbt_print __P((DBT *));
+int main __P((int, char *[]));
+void usage __P((void));
-const char *progname = "db_dump185"; /* Program name. */
+const char
+ *progname = "db_dump185"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_load/db_load.c b/db2/progs/db_load/db_load.c
index cc90e7bd27..6f69216777 100644
--- a/db2/progs/db_load/db_load.c
+++ b/db2/progs/db_load/db_load.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_load.c 10.9 (Sleepycat) 8/19/97";
+static const char sccsid[] = "@(#)db_load.c 10.12 (Sleepycat) 8/28/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -19,11 +19,11 @@ static const char sccsid[] = "@(#)db_load.c 10.9 (Sleepycat) 8/19/97";
#include <sys/stat.h>
#include <errno.h>
-#include <getopt.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#endif
#include "db_int.h"
@@ -35,11 +35,12 @@ DB_ENV *db_init __P((char *));
int dbt_rdump __P((DBT *));
int dbt_rprint __P((DBT *));
int digitize __P((int));
+int main __P((int, char *[]));
void rheader __P((DBTYPE *, int *, DB_INFO *));
void usage __P((void));
-int main __P((int, char *[]));
-const char *progname = "db_load"; /* Program name. */
+const char
+ *progname = "db_load"; /* Program name. */
int
main(argc, argv)
@@ -273,7 +274,7 @@ rheader(dbtypep, pflagp, dbinfop)
for (lineno = 1;; ++lineno) {
if (fscanf(stdin, "%[^=]=%s\n", name, value) != 2)
- errx(1, "line %lu: unexpected line", lineno);
+ errx(1, "line %lu: unexpected format", lineno);
if (strcmp(name, "HEADER") == 0)
break;
diff --git a/db2/progs/db_printlog/db_printlog.c b/db2/progs/db_printlog/db_printlog.c
index 12c365524f..6bbd118b1b 100644
--- a/db2/progs/db_printlog/db_printlog.c
+++ b/db2/progs/db_printlog/db_printlog.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_printlog.c 10.8 (Sleepycat) 7/15/97";
+static const char sccsid[] = "@(#)db_printlog.c 10.10 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -35,11 +35,13 @@ static const char sccsid[] = "@(#)db_printlog.c 10.8 (Sleepycat) 7/15/97";
#include "clib_ext.h"
DB_ENV *db_init __P((char *));
+int main __P((int, char *[]));
void onint __P((int));
void usage __P((void));
int interrupted;
-char *progname = "db_printlog"; /* Program name. */
+const char
+ *progname = "db_printlog"; /* Program name. */
int
main(argc, argv)
@@ -114,7 +116,7 @@ main(argc, argv)
(void)raise(SIGINT);
/* NOTREACHED */
}
- exit (eval);
+ return (eval);
}
/*
diff --git a/db2/progs/db_recover/db_recover.c b/db2/progs/db_recover/db_recover.c
index 4ac5925f79..d17c4b0c76 100644
--- a/db2/progs/db_recover/db_recover.c
+++ b/db2/progs/db_recover/db_recover.c
@@ -11,16 +11,16 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_recover.c 10.12 (Sleepycat) 7/27/97";
+static const char sccsid[] = "@(#)db_recover.c 10.14 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <errno.h>
-#include <getopt.h>
#include <stdlib.h>
#include <time.h>
+#include <unistd.h>
#endif
#include "db_int.h"
@@ -29,10 +29,11 @@ static const char sccsid[] = "@(#)db_recover.c 10.12 (Sleepycat) 7/27/97";
#include "clib_ext.h"
DB_ENV *db_init __P((char *, int, int));
-void usage __P((void));
int main __P((int, char *[]));
+void usage __P((void));
-const char *progname = "db_recover"; /* Program name. */
+const char
+ *progname = "db_recover"; /* Program name. */
int
main(argc, argv)
diff --git a/db2/progs/db_stat/db_stat.c b/db2/progs/db_stat/db_stat.c
index 5c7044dbce..1a989f4df3 100644
--- a/db2/progs/db_stat/db_stat.c
+++ b/db2/progs/db_stat/db_stat.c
@@ -11,7 +11,7 @@
static const char copyright[] =
"@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\n";
-static const char sccsid[] = "@(#)db_stat.c 8.17 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)db_stat.c 8.20 (Sleepycat) 8/27/97";
#endif
#ifndef NO_SYSTEM_INCLUDES
@@ -36,16 +36,17 @@ typedef enum { T_NOTSET, T_DB, T_MPOOL, T_TXN } test_t;
void bstat __P((DB *));
DB_ENV *db_init __P((char *, test_t));
void hstat __P((DB *));
+int main __P((int, char *[]));
void mstat __P((DB_ENV *));
-void prflags __P((u_int32_t, const FN *));
void onint __P((int));
+void prflags __P((u_int32_t, const FN *));
void tstat __P((DB_ENV *));
int txn_compare __P((const void *, const void *));
void usage __P((void));
-int main __P((int, char *[]));
int interrupted;
-const char *progname = "db_stat"; /* Program name. */
+const char
+ *progname = "db_stat"; /* Program name. */
int
main(argc, argv)
@@ -297,7 +298,7 @@ tstat(dbenv)
DB_ENV *dbenv;
{
DB_TXN_STAT *tstat;
- unsigned int i;
+ u_int32_t i;
const char *p;
if (txn_stat(dbenv->tx_info, &tstat, NULL))
diff --git a/db2/txn/txn.c b/db2/txn/txn.c
index b20697be3b..cb700dc037 100644
--- a/db2/txn/txn.c
+++ b/db2/txn/txn.c
@@ -43,7 +43,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)txn.c 10.20 (Sleepycat) 8/24/97";
+static const char sccsid[] = "@(#)txn.c 10.24 (Sleepycat) 9/3/97";
#endif /* not lint */
@@ -80,12 +80,11 @@ static const char sccsid[] = "@(#)txn.c 10.20 (Sleepycat) 8/24/97";
#include "common_ext.h"
static int __txn_check_running __P((const DB_TXN *));
-
-static int __txn_create __P((DB_ENV *, const char *, u_int));
-static int __txn_grow_region __P((DB_TXNMGR *));
-static int __txn_validate_region __P((DB_TXNMGR *));
-static int __txn_end __P((DB_TXN *, int));
-static int __txn_undo __P((DB_TXN *));
+static int __txn_create __P((DB_ENV *, const char *, u_int));
+static int __txn_end __P((DB_TXN *, int));
+static int __txn_grow_region __P((DB_TXNMGR *));
+static int __txn_undo __P((DB_TXN *));
+static int __txn_validate_region __P((DB_TXNMGR *));
/*
* Create and initialize a transaction region in shared memory.
@@ -622,6 +621,7 @@ txn_checkpoint(mgr, kbytes, minutes)
if (minutes != 0 || kbytes != 0)
return (0);
+do_ckp:
if (IS_ZERO_LSN(ckp_lsn)) {
dblp = mgr->dbenv->lg_info;
LOCK_LOGREGION(dblp);
@@ -633,7 +633,6 @@ txn_checkpoint(mgr, kbytes, minutes)
* We have to find an LSN such that all transactions begun
* before that LSN are complete.
*/
-do_ckp:
LOCK_TXNREGION(mgr);
if (!IS_ZERO_LSN(mgr->region->pending_ckp))
@@ -755,8 +754,7 @@ txn_stat(mgr, statp, db_malloc)
{
DB_TXN_STAT *stats;
size_t nbytes;
- u_int32_t nactive;
- unsigned int i, ndx;
+ u_int32_t i, nactive, ndx;
LOCK_TXNREGION(mgr);
nactive = mgr->region->nbegins -
diff --git a/db2/txn/txn_rec.c b/db2/txn/txn_rec.c
index 1fe720a1cf..c172d874d9 100644
--- a/db2/txn/txn_rec.c
+++ b/db2/txn/txn_rec.c
@@ -40,7 +40,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)txn_rec.c 10.4 (Sleepycat) 7/2/97";
+static const char sccsid[] = "@(#)txn_rec.c 10.5 (Sleepycat) 8/27/97";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -127,5 +127,5 @@ __txn_ckp_recover(logp, dbtp, lsnp, redo, info)
*lsnp = argp->last_ckp;
free(argp);
- return (1);
+ return (DB_TXN_CKP);
}
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 7e851cd0af..fa9e92cb9f 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -1,5 +1,5 @@
-/* _dl_close -- Close a shared object opened by `_dl_open'.
- Copyright (C) 1996 Free Software Foundation, Inc.
+/* Close a shared object opened by `_dl_open'.
+ Copyright (C) 1996, 1997 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
@@ -23,8 +23,14 @@
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
+#include <libc-lock.h>
+/* During the program run we must not modify the global data of
+ loaded shared object simultanously in two threads. Therefore we
+ protect `dlopen' and `dlclose' in dlclose.c. */
+__libc_lock_define (extern, _dl_load_lock)
+
#define LOSE(s) _dl_signal_error (0, map->l_name, s)
void
@@ -36,10 +42,16 @@ _dl_close (struct link_map *map)
if (map->l_opencount == 0)
LOSE ("shared object not open");
+ /* Acquire the lock. */
+ __libc_lock_lock (_dl_load_lock);
+
/* Decrement the reference count. */
if (--map->l_opencount > 0 || map->l_type != lt_loaded)
- /* There are still references to this object. Do nothing more. */
- return;
+ {
+ /* There are still references to this object. Do nothing more. */
+ __libc_lock_unlock (_dl_load_lock);
+ return;
+ }
/* Notify the debugger we are about to remove some loaded objects. */
_r_debug.r_state = RT_DELETE;
@@ -114,4 +126,7 @@ _dl_close (struct link_map *map)
/* Notify the debugger those objects are finalized and gone. */
_r_debug.r_state = RT_CONSISTENT;
_dl_debug_state ();
+
+ /* Release the lock. */
+ __libc_lock_unlock (_dl_load_lock);
}
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 38db7677b0..27de231dff 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -84,7 +84,7 @@ _dl_map_object_deps (struct link_map *map,
int trace_mode)
{
struct list known[1 + npreloads + 1];
- struct list *runp, *head, *utail, *dtail;
+ struct list *runp, *utail, *dtail;
unsigned int nlist, nduplist, i;
inline void preload (struct link_map *map)
@@ -116,9 +116,6 @@ _dl_map_object_deps (struct link_map *map,
known[nlist - 1].unique = NULL;
known[nlist - 1].dup = NULL;
- /* Pointer to the first member of the unique and duplicate list. */
- head = known;
-
/* Pointer to last unique object. */
utail = &known[nlist - 1];
/* Pointer to last loaded object. */
@@ -300,7 +297,7 @@ _dl_map_object_deps (struct link_map *map,
situation is really not that frequent. So
we don't use a double-linked list but
instead search for the preceding element. */
- late = head;
+ late = known;
while (late->unique != orig)
late = late->unique;
late->unique = newp;
@@ -361,7 +358,7 @@ _dl_map_object_deps (struct link_map *map,
"cannot allocate symbol search list");
map->l_nsearchlist = nlist;
- for (nlist = 0, runp = head; runp; runp = runp->unique)
+ for (nlist = 0, runp = known; runp; runp = runp->unique)
{
map->l_searchlist[nlist++] = runp->map;
@@ -380,7 +377,7 @@ _dl_map_object_deps (struct link_map *map,
_dl_signal_error (ENOMEM, map->l_name,
"cannot allocate symbol search list");
- for (nlist = 0, runp = head; runp; runp = runp->dup)
+ for (nlist = 0, runp = known; runp; runp = runp->dup)
map->l_dupsearchlist[nlist++] = runp->map;
}
}
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 529806cc36..113e472165 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -21,6 +21,7 @@
#include <dlfcn.h>
#include <stdlib.h>
#include <errno.h>
+#include <libc-lock.h>
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
@@ -38,6 +39,17 @@ extern char **__environ;
size_t _dl_global_scope_alloc;
+
+/* During the program run we must not modify the global data of
+ loaded shared object simultanously in two threads. Therefore we
+ protect `_dl_open' and `_dl_close' in dl-close.c.
+
+ This must be a recursive lock since the initializer function of
+ the loaded object might as well require a call to this function.
+ At this time it is not anymore a problem to modify the tables. */
+__libc_lock_define_initialized_recursive (, _dl_load_lock)
+
+
struct link_map *
_dl_open (const char *file, int mode)
{
@@ -45,11 +57,17 @@ _dl_open (const char *file, int mode)
ElfW(Addr) init;
struct r_debug *r;
+ /* Make sure we are alone. */
+ __libc_lock_lock (_dl_load_lock);
+
/* Load the named object. */
new = _dl_map_object (NULL, file, lt_loaded, 0);
if (new->l_searchlist)
- /* It was already open. */
- return new;
+ {
+ /* It was already open. */
+ __libc_lock_unlock (_dl_load_lock);
+ return new;
+ }
/* Load that object's dependencies. */
_dl_map_object_deps (new, NULL, 0, 0);
@@ -152,5 +170,8 @@ _dl_open (const char *file, int mode)
has loaded a dynamic object now has competition. */
__libc_multiple_libcs = 1;
+ /* Release the lock. */
+ __libc_lock_unlock (_dl_load_lock);
+
return new;
}
diff --git a/elf/dl-version.c b/elf/dl-version.c
index b5515c86e0..0f98dd057c 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -46,7 +46,7 @@ extern char **_dl_argv;
\
cp = result = alloca (len); \
for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
- cp = stpcpy (cp, all[cnt]); \
+ cp = __stpcpy (cp, all[cnt]); \
\
result; \
})
@@ -55,11 +55,12 @@ extern char **_dl_argv;
static inline struct link_map *
find_needed (const char *name, struct link_map *map)
{
+ struct link_map *tmap;
unsigned int n;
- for (n = 0; n < _dl_loaded->l_nsearchlist; ++n)
- if (_dl_name_match_p (name, _dl_loaded->l_searchlist[n]))
- return _dl_loaded->l_searchlist[n];
+ for (tmap = _dl_loaded; tmap != NULL; tmap = tmap->l_next)
+ if (_dl_name_match_p (name, tmap))
+ return tmap;
/* The required object is not in the global scope, look to see if it is
a dependency of the current object. */
diff --git a/elf/dlclose.c b/elf/dlclose.c
index d96ffc9cc1..a2ec750baf 100644
--- a/elf/dlclose.c
+++ b/elf/dlclose.c
@@ -1,5 +1,5 @@
-/* dlclose -- Close a handle opened by `dlopen'.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Close a handle opened by `dlopen'.
+ Copyright (C) 1995, 1996, 1997 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
diff --git a/libio/stdfiles.c b/libio/stdfiles.c
index 8453e33c34..da921321a6 100644
--- a/libio/stdfiles.c
+++ b/libio/stdfiles.c
@@ -49,3 +49,10 @@ DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
_IO_NO_READS+_IO_UNBUFFERED);
_IO_FILE *_IO_list_all = &_IO_stderr_.file;
+
+#ifdef _G_USING_THUNKS
+#if defined(__GNUC__) && __GNUC__ >= 2
+const
+#endif
+int _libio_using_thunks = 1;
+#endif
diff --git a/manual/maint.texi b/manual/maint.texi
index 654182e6e1..c17718111c 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -76,12 +76,13 @@ Use this option if your computer lacks hardware floating-point support.
@item --prefix=@var{directory}
Install machine-independent data files in subdirectories of
@file{@var{directory}}. (You can also set this in @file{configparms};
-see below.)
+see below.) The default is to install in `/usr/local'.
@item --exec-prefix=@var{directory}
Install the library and other machine-dependent files in subdirectories
of @file{@var{directory}}. (You can also set this in
-@file{configparms}; see below.)
+@file{configparms}; see below.) The default is to use <prefix>/bin
+and <prefix>/sbin.
@item --enable-shared
@itemx --disable-shared
@@ -751,10 +752,12 @@ level of the @file{sysdeps} hierarchy. This directory contains
subdirectories (and subdirectory trees) for various Unix variants.
The functions which are system calls in most Unix systems are
-implemented in assembly code in files in @file{sysdeps/unix}. These
-files are named with a suffix of @samp{.S}; for example,
-@file{__open.S}. Files ending in @samp{.S} are run through the C
-preprocessor before being fed to the assembler.
+implemented in assembly code, which is generated automatically from
+specifications in the file @file{sysdeps/unix/syscalls.list}. Some
+special system calls are implemented in files that are named with a
+suffix of @samp{.S}; for example, @file{_exit.S}. Files ending in
+@samp{.S} are run through the C preprocessor before being fed to the
+assembler.
These files all use a set of macros that should be defined in
@file{sysdep.h}. The @file{sysdep.h} file in @file{sysdeps/unix}
@@ -810,16 +813,9 @@ by Douglas C. Schmidt.
The memory allocation functions @code{malloc}, @code{realloc} and
@code{free} and related code were written by Michael J. Haertel.
-@comment tege's name has an umlaut.
-@tex
-\xdef\SETtege{Torbj\"orn Granlund}
-@end tex
-@ifinfo
-@set tege Torbjorn Granlund
-@end ifinfo
@item
Fast implementations of many of the string functions (@code{memcpy},
-@code{strlen}, etc.) were written by @value{tege}.
+@code{strlen}, etc.) were written by Torbj@"orn Granlund.
@item
The @file{tar.h} header file was written by David J. MacKenzie.
@@ -868,7 +864,7 @@ The floating-point printing function used by @code{printf} and friends
and the floating-point reading function used by @code{scanf},
@code{strtod} and friends were written by Ulrich Drepper. The
multi-precision integer functions used in those functions are taken from
-GNU MP, which was contributed by @value{tege}.
+GNU MP, which was contributed by Torbj@"orn Granlund.
@item
The internationalization support in the library, and the support
diff --git a/manual/math.texi b/manual/math.texi
index a703e890a2..2b7cb82f5e 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -698,6 +698,11 @@ the processor understands. But on machines missing these functions, the
macros above might be rather slow. So it is best to use the builtin
operators unless it is necessary to use unordered comparisons.
+@strong{Note:} There are no macros @code{isequal} or @code{isunequal}.
+These macros are not necessary since the @w{IEEE 754} standard requires
+that the comparison for equality and unequality do @emph{not} throw an
+exception if one of the arguments is an unordered value.
+
@node Trig Functions
@section Trigonometric Functions
diff --git a/manual/message.texi b/manual/message.texi
index 76587d1381..deb778440d 100644
--- a/manual/message.texi
+++ b/manual/message.texi
@@ -1039,6 +1039,12 @@ The @code{bindtextdomain} function can be used several times and if the
@var{domainname} argument is different the previously boundd domains
will not be overwritten.
+If the program which wish to use @code{bindtextdomain} at some point of
+time use the @code{chdir} function to change the current working
+directory it is important that the @var{dirname} strings ought to be an
+absolute pathname. Otherwise the addressed directory might vary with
+the time.
+
If the @var{dirname} parameter is the null pointer @code{bindtextdomain}
returns the currently selected directory for the domain with the name
@var{domainname}.
diff --git a/manual/string.texi b/manual/string.texi
index 07ed35b8ab..48aaaf0965 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -357,7 +357,7 @@ Its behaviour is undefined if the strings overlap.
@comment string.h
@comment GNU
-@deftypefun {char *} strdupa (const char *@var{s})
+@deftypefn {Macro} {char *} strdupa (const char *@var{s})
This function is similar to @code{strdup} but allocates the new string
using @code{alloca} instead of @code{malloc}
@pxref{Variable Size Automatic}. This means of course the returned
@@ -377,11 +377,11 @@ Please note that calling @code{strtok} using @var{path} directly is
invalid.
This function is only available if GNU CC is used.
-@end deftypefun
+@end deftypefn
@comment string.h
@comment GNU
-@deftypefun {char *} strndupa (const char *@var{s}, size_t @var{size})
+@deftypefn {Macro} {char *} strndupa (const char *@var{s}, size_t @var{size})
This function is similar to @code{strndup} but like @code{strdupa} it
allocates the new string using @code{alloca}
@pxref{Variable Size Automatic}. The same advantages and limitations
@@ -391,7 +391,7 @@ This function is implemented only as a macro which means one cannot
get the address of it.
@code{strndupa} is only available if GNU CC is used.
-@end deftypefun
+@end deftypefn
@comment string.h
@comment ISO
diff --git a/nss/Makefile b/nss/Makefile
index 86de2e9d57..904d3ec423 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -36,8 +36,10 @@ routines = nsswitch $(addsuffix -lookup,$(databases))
databases = proto service hosts network grp pwd rpc ethers \
spwd netgrp key alias
+include ../Makeconfig
+
# Specify rules for the nss_* modules. We have some services.
-services := files db
+services := files db $(LDAP)
extra-libs = $(services:%=libnss_%)
# These libraries will be built in the `others' pass rather than
@@ -60,17 +62,25 @@ generated += $(filter-out db-alias.c db-netgrp.c, \
$(addsuffix .c,$(libnss_db-routines)))
distribute += db-XXX.c
+libnss_ldap-routines := $(addprefix ldap-,proto) util ldap-nss
+libnss_ldap-map := libnss_ldap.map
+
ifneq ($(build-static-nss),yes)
libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
+libnss_ldap-inhibit-o = $(filter-out .os,$(object-suffixes))
endif
+# If we compile the LDAP module we need the headers from the LDAP library.
+ifneq ($(LDAP),)
+CPPFLAGS += -I../ldap
+endif
include ../Rules
-$(objpfx)libnss_db.so: $(common-objpfx)db2/libdb.so $(objpfx)libnss_files.so
+$(objpfx)libnss_db.so: $(dbobjdir)/libdb.so $(objpfx)libnss_files.so
$(libnss_db-routines:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
@rm -f $@.new
@@ -79,6 +89,9 @@ $(libnss_db-routines:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
echo '#include <$<>') > $@.new
mv -f $@.new $@
+# To complete the LDAP NSS module we need functions from the LDAP library.
+$(objpfx)libnss_ldap.so: $(common-objpfx)ldap/libldap.so
+
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This ensures they will load libc.so for needed symbols if loaded by
# a statically-linked program that hasn't already loaded it.
diff --git a/shlib-versions b/shlib-versions
index fe08fde2a7..33412a4e1e 100644
--- a/shlib-versions
+++ b/shlib-versions
@@ -62,12 +62,14 @@ alpha-.*-linux.* libnss_db=1.1
alpha-.*-linux.* libnss_compat=1.1
alpha-.*-linux.* libnss_nis=1.1
alpha-.*-linux.* libnss_nisplus=1.1
+alpha-.*-linux.* libnss_ldap=1.1
.*-.*-.* libnss_files=1
.*-.*-.* libnss_dns=1
.*-.*-.* libnss_db=1
.*-.*-.* libnss_compat=1
.*-.*-.* libnss_nis=1
.*-.*-.* libnss_nisplus=1
+.*-.*-.* libnss_ldap=1
# Version for libnsl with YP and NIS+ functions.
alpha-.*-linux.* libnsl=1.1
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index baee72e85b..bde8cdc717 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -107,6 +107,7 @@ CFLAGS-xrusers.c = -Wno-unused
CFLAGS-xspray.c = -Wno-unused
CFLAGS-xnfs_prot.c = -Wno-unused
CFLAGS-xrquota.c = -Wno-unused
+CFLAGS-xkey_prot.c = -Wno-unused
include ../Rules
diff --git a/sunrpc/rpc_cout.c b/sunrpc/rpc_cout.c
index ab3b24da74..3b1102d2bb 100644
--- a/sunrpc/rpc_cout.c
+++ b/sunrpc/rpc_cout.c
@@ -175,7 +175,7 @@ print_prog_header(const proc_list *plist)
static void
print_trailer(void)
{
- f_print(fout, "\treturn (TRUE);\n");
+ f_print(fout, "\treturn TRUE;\n");
f_print(fout, "}\n");
}
@@ -213,7 +213,7 @@ print_ifclose(int indent)
{
f_print(fout, ")) {\n");
tabify(fout, indent);
- f_print(fout, "\t return (FALSE);\n");
+ f_print(fout, "\t return FALSE;\n");
tabify(fout, indent);
f_print(fout, " }\n");
}
@@ -377,7 +377,7 @@ emit_union(const definition *def)
#endif
} else {
f_print(fout, "\tdefault:\n");
- f_print(fout, "\t\treturn (FALSE);\n");
+ f_print(fout, "\t\treturn FALSE;\n");
}
f_print(fout, "\t}\n");
@@ -444,7 +444,7 @@ emit_struct(definition *def)
if(flag == PUT)
f_print(fout,"\n\t if (xdrs->x_op == XDR_ENCODE) {\n");
else
- f_print(fout,"\n \t return (TRUE);\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
+ f_print(fout,"\n \t return TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
i=0;
@@ -583,7 +583,7 @@ emit_struct(definition *def)
}
flag=GET;
}
- f_print(fout,"\t return(TRUE);\n\t}\n\n");
+ f_print(fout,"\t return TRUE;\n\t}\n\n");
/* now take care of XDR_FREE case */
diff --git a/sysdeps/alpha/fpu/e_sqrt.c b/sysdeps/alpha/fpu/e_sqrt.c
new file mode 100644
index 0000000000..76fa015622
--- /dev/null
+++ b/sysdeps/alpha/fpu/e_sqrt.c
@@ -0,0 +1,256 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+ 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. */
+
+/*
+ * We have three versions, depending on how exact we need the results.
+ */
+
+#if defined(_IEEE_FP) && defined(_IEEE_FP_INEXACT)
+
+/* Most demanding: go to the original source. */
+#include <libm-ieee754/e_sqrt.c>
+
+#else
+
+/* Careful with rearranging this without consulting the assembly below. */
+const static struct sqrt_data_struct {
+ unsigned long dn, up, half, almost_three_half;
+ unsigned long one_and_a_half, two_to_minus_30, one, nan;
+ const int T2[64];
+} sqrt_data = {
+ 0x3fefffffffffffff, /* __dn = nextafter(1,-Inf) */
+ 0x3ff0000000000001, /* __up = nextafter(1,+Inf) */
+ 0x3fe0000000000000, /* half */
+ 0x3ff7ffffffc00000, /* almost_three_half = 1.5-2^-30 */
+ 0x3ff8000000000000, /* one_and_a_half */
+ 0x3e10000000000000, /* two_to_minus_30 */
+ 0x3ff0000000000000, /* one */
+ 0xffffffffffffffff, /* nan */
+
+ { 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866,
+ 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f,
+ 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d,
+ 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0,
+ 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989,
+ 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd,
+ 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e,
+ 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd }
+};
+
+#ifdef _IEEE_FP
+/*
+ * This version is much faster than the standard one included above,
+ * but it doesn't maintain the inexact flag.
+ */
+
+#define lobits(x) (((unsigned int *)&x)[0])
+#define hibits(x) (((unsigned int *)&x)[1])
+
+static inline double initial_guess(double x, unsigned int k,
+ const struct sqrt_data_struct * const ptr)
+{
+ double ret = 0.0;
+
+ k = 0x5fe80000 - (k >> 1);
+ k = k - ptr->T2[63&(k>>14)];
+ hibits(ret) = k;
+ return ret;
+}
+
+/* up = nextafter(1,+Inf), dn = nextafter(1,-Inf) */
+
+#define __half (ptr->half)
+#define __one_and_a_half (ptr->one_and_a_half)
+#define __two_to_minus_30 (ptr->two_to_minus_30)
+#define __one (ptr->one)
+#define __up (ptr->up)
+#define __dn (ptr->dn)
+#define __Nan (ptr->nan)
+
+#define Double(x) (*(double *)&x)
+
+/* Multiply with chopping rounding.. */
+#define choppedmul(a,b,c) \
+ __asm__("multc %1,%2,%0":"=&f" (c):"f" (a), "f" (b))
+
+double
+__ieee754_sqrt(double x)
+{
+ const struct sqrt_data_struct * const ptr = &sqrt_data;
+ unsigned long k, bits;
+ double y, z, zp, zn;
+ double dn, up, low, high;
+ double half, one_and_a_half, one, two_to_minus_30;
+
+ *(double *)&bits = x;
+ k = bits;
+
+ /* Negative or NaN or Inf */
+ if ((k >> 52) >= 0x7ff)
+ goto special;
+ y = initial_guess(x, k >> 32, ptr);
+ half = Double(__half);
+ one_and_a_half = Double(__one_and_a_half);
+ y = y*(one_and_a_half - half*x*y*y);
+ dn = Double(__dn);
+ two_to_minus_30 = Double(__two_to_minus_30);
+ y = y*((one_and_a_half - two_to_minus_30) - half*x*y*y);
+ up = Double(__up);
+ z = x*y;
+ one = Double(__one);
+ z = z + half*z*(one-z*y);
+
+ choppedmul(z,dn,zp);
+ choppedmul(z,up,zn);
+
+ choppedmul(z,zp,low);
+ low = low - x;
+ choppedmul(z,zn,high);
+ high = high - x;
+
+ /* I can't get gcc to use fcmov's.. */
+ __asm__("fcmovge %2,%3,%0"
+ :"=f" (z)
+ :"0" (z), "f" (low), "f" (zp));
+ __asm__("fcmovlt %2,%3,%0"
+ :"=f" (z)
+ :"0" (z), "f" (high), "f" (zn));
+ return z; /* Argh! gcc jumps to end here */
+
+special:
+ /* throw away sign bit */
+ k <<= 1;
+ /* -0 */
+ if (!k)
+ return x;
+ /* special? */
+ if ((k >> 53) == 0x7ff) {
+ /* NaN? */
+ if (k << 11)
+ return x;
+ /* sqrt(+Inf) = +Inf */
+ if (x > 0)
+ return x;
+ }
+
+ x = Double(__Nan);
+ return x;
+}
+
+#else
+/*
+ * This version is much faster than generic sqrt implementation, but
+ * it doesn't handle exceptional values or the inexact flag.
+ */
+
+asm ("\
+ /* Define offsets into the structure defined in C above. */
+ $DN = 0*8
+ $UP = 1*8
+ $HALF = 2*8
+ $ALMOST_THREE_HALF = 3*8
+ $NAN = 7*8
+ $T2 = 8*8
+
+ /* Stack variables. */
+ $K = 0
+ $Y = 8
+
+ .text
+ .align 3
+ .globl __ieee754_sqrt
+ .ent __ieee754_sqrt
+__ieee754_sqrt:
+ ldgp $29, 0($27)
+ subq $sp, 16, $sp
+ .frame $sp, 16, $26, 0\n"
+#ifdef PROF
+" lda $28, _mcount
+ jsr $28, ($28), _mcount\n"
+#endif
+" .prologue 1
+
+ stt $f16, $K($sp)
+ lda $4, sqrt_data # load base address into t3
+ fblt $f16, $negative
+
+ /* Compute initial guess. */
+
+ .align 3
+
+ ldah $2, 0x5fe8 # e0 :
+ ldq $3, $K($sp) # .. e1 :
+ ldt $f12, $HALF($4) # e0 :
+ ldt $f18, $ALMOST_THREE_HALF($4) # .. e1 :
+ srl $3, 33, $1 # e0 :
+ mult $f16, $f12, $f11 # .. fm : $f11 = x * 0.5
+ subl $2, $1, $2 # e0 :
+ addt $f12, $f12, $f17 # .. fa : $f17 = 1.0
+ srl $2, 12, $1 # e0 :
+ and $1, 0xfc, $1 # .. e1 :
+ addq $1, $4, $1 # e0 :
+ ldl $1, $T2($1) # .. e1 :
+ addt $f12, $f17, $f15 # fa : $f15 = 1.5
+ subl $2, $1, $2 # .. e1 :
+ sll $2, 32, $2 # e0 :
+ ldt $f14, $DN($4) # .. e1 :
+ stq $2, $Y($sp) # e0 :
+ ldt $f13, $Y($sp) # e1 :
+
+ mult $f11, $f13, $f10 # fm : $f10 = (x * 0.5) * y
+ mult $f10, $f13, $f10 # fm : $f10 = ((x * 0.5) * y) * y
+ subt $f15, $f10, $f1 # fa : $f1 = (1.5 - 0.5*x*y*y)
+ mult $f13, $f1, $f13 # fm : yp = y*(1.5 - 0.5*x*y*y)
+ mult $f11, $f13, $f11 # fm : $f11 = x * 0.5 * yp
+ mult $f11, $f13, $f11 # fm : $f11 = (x * 0.5 * yp) * yp
+ subt $f18, $f11, $f1 # fa : $f1= (1.5-2^-30) - 0.5*x*yp*yp
+ mult $f13, $f1, $f13 # fm : ypp = $f13 = yp*$f1
+ subt $f15, $f12, $f1 # fa : $f1 = (1.5 - 0.5)
+ ldt $f15, $UP($4) # .. e1 :
+ mult $f16, $f13, $f10 # fm : z = $f10 = x * ypp
+ mult $f10, $f13, $f11 # fm : $f11 = z*ypp
+ mult $f10, $f12, $f12 # fm : $f12 = z*0.5
+ subt $f1, $f11, $f1 # .. fa : $f1 = 1 - z*ypp
+ mult $f12, $f1, $f12 # fm : $f12 = z*0.5*(1 - z*ypp)
+ addt $f10, $f12, $f0 # fa : zp=res=$f0= z + z*0.5*(1 - z*ypp)
+
+ mult/c $f0, $f14, $f12 # fm : zmi = zp * DN
+ mult/c $f0, $f15, $f11 # fm : zpl = zp * UP
+ mult/c $f0, $f12, $f1 # fm : $f1 = zp * zmi
+ mult/c $f0, $f11, $f15 # fm : $f15 = zp * zpl
+
+ subt $f1, $f16, $f13 # fa : y1 = zp*zmi - x
+ subt $f15, $f16, $f15 # fa : y2 = zp*zpl - x
+
+ fcmovge $f13, $f12, $f0 # res = (y1 >= 0) ? zmi : res
+ fcmovlt $f15, $f11, $f0 # res = (y2 < 0) ? zpl : res
+
+ addq $sp, 16, $sp # e0 :
+ ret # .. e1 :
+
+$negative:
+ ldt $f0, $NAN($4)
+ addq $sp, 16, $sp
+ ret
+
+ .end __ieee754_sqrt");
+
+#endif /* _IEEE_FP */
+#endif /* _IEEE_FP && _IEEE_FP_INEXACT */
diff --git a/sysdeps/alpha/w_sqrt.S b/sysdeps/alpha/w_sqrt.S
deleted file mode 100644
index 32b06887d5..0000000000
--- a/sysdeps/alpha/w_sqrt.S
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by David Mosberger <davidm@cs.arizona.edu>, 1996.
- Based on public-domain C source by Linus Torvalds.
-
- 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. */
-
-/* This version is much faster than generic sqrt implementation, but
- it doesn't handle exceptional values or the inexact flag. Don't use
- this if _IEEE_FP or _IEEE_FP_INEXACT is in effect. */
-
-#ifndef _IEEE_FP
-
-#define _ERRNO_H
-#include <bits/errno.h>
-#include <sysdep.h>
-
- .set noreorder
-
-#ifdef __ELF__
- .section .rodata
-#else
- .rdata
-#endif
- .align 5 # align to cache line
-
- /* Do all memory accesses relative to sqrtdata. */
-sqrtdata:
-
-#define DN 0x00
-#define UP 0x08
-#define HALF 0x10
-#define ALMOST_THREE_HALF 0x18
-#define T2 0x20
-
- .quad 0x3fefffffffffffff /* DN = next(1.0) */
- .quad 0x3ff0000000000001 /* UP = prev(1.0) */
- .quad 0x3fe0000000000000 /* HALF = 0.5 */
- .quad 0x3ff7ffffffc00000 /* ALMOST_THREE_HALF = 1.5-2^-30 */
-
-/* table T2: */
-.long 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866
-.long 0xf14a, 0x1091b, 0x11fcd, 0x13552, 0x14999, 0x15c98, 0x16e34, 0x17e5f
-.long 0x18d03, 0x19a01, 0x1a545, 0x1ae8a, 0x1b5c4, 0x1bb01, 0x1bfde, 0x1c28d
-.long 0x1c2de, 0x1c0db, 0x1ba73, 0x1b11c, 0x1a4b5, 0x1953d, 0x18266, 0x16be0
-.long 0x1683e, 0x179d8, 0x18a4d, 0x19992, 0x1a789, 0x1b445, 0x1bf61, 0x1c989
-.long 0x1d16d, 0x1d77b, 0x1dddf, 0x1e2ad, 0x1e5bf, 0x1e6e8, 0x1e654, 0x1e3cd
-.long 0x1df2a, 0x1d635, 0x1cb16, 0x1be2c, 0x1ae4e, 0x19bde, 0x1868e, 0x16e2e
-.long 0x1527f, 0x1334a, 0x11051, 0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd
-
-/*
- * Stack variables:
- */
-#define K 16(sp)
-#define Y 24(sp)
-#define FSIZE 32
-
- .text
-
-LEAF(__sqrt, FSIZE)
- lda sp, -FSIZE(sp)
- ldgp gp, .-__sqrt(pv)
- stq ra, 0(sp)
-#ifdef PROF
- lda AT, _mcount
- jsr AT, (AT), _mcount
-#endif
- .prologue 1
-
- stt $f16, K
- lda t3, sqrtdata # load base address into t3
-
- fblt $f16, $negative
-
- /* Compute initial guess. */
-
- .align 3
-
- ldah t1, 0x5fe8 # e0 :
- ldq t2, K # .. e1 :
- ldt $f12, HALF(t3) # e0 :
- ldt $f18, ALMOST_THREE_HALF(t3) # .. e1 :
- srl t2, 33, t0 # e0 :
- mult $f16, $f12, $f11 # .. fm : $f11 = x * 0.5
- subl t1, t0, t1 # e0 :
- addt $f12, $f12, $f17 # .. fa : $f17 = 1.0
- srl t1, 12, t0 # e0 :
- and t0, 0xfc, t0 # .. e1 :
- addq t0, t3, t0 # e0 :
- ldl t0, T2(t0) # .. e1 :
- addt $f12, $f17, $f15 # fa : $f15 = 1.5
- subl t1, t0, t1 # .. e1 :
- sll t1, 32, t1 # e0 :
- ldt $f14, DN(t3) # .. e1 :
- stq t1, Y # e0 :
- ldt $f13, Y # e1 :
- addq sp, FSIZE, sp # e0 :
-
- mult $f11, $f13, $f10 # fm : $f10 = (x * 0.5) * y
- mult $f10, $f13, $f10 # fm : $f10 = ((x * 0.5) * y) * y
- subt $f15, $f10, $f1 # fa : $f1 = (1.5 - 0.5*x*y*y)
- mult $f13, $f1, $f13 # fm : yp = y*(1.5 - 0.5*x*y*y)
- mult $f11, $f13, $f11 # fm : $f11 = x * 0.5 * yp
- mult $f11, $f13, $f11 # fm : $f11 = (x * 0.5 * yp) * yp
- subt $f18, $f11, $f1 # fa : $f1= (1.5-2^-30) - 0.5*x*yp*yp
- mult $f13, $f1, $f13 # fm : ypp = $f13 = yp*$f1
- subt $f15, $f12, $f1 # fa : $f1 = (1.5 - 0.5)
- ldt $f15, UP(t3) # .. e1 :
- mult $f16, $f13, $f10 # fm : z = $f10 = x * ypp
- mult $f10, $f13, $f11 # fm : $f11 = z*ypp
- mult $f10, $f12, $f12 # fm : $f12 = z*0.5
- subt $f1, $f11, $f1 # .. fa : $f1 = 1 - z*ypp
- mult $f12, $f1, $f12 # fm : $f12 = z*0.5*(1 - z*ypp)
- addt $f10, $f12, $f0 # fa : zp=res=$f0= z + z*0.5*(1 - z*ypp)
-
- mult/c $f0, $f14, $f12 # fm : zmi = zp * DN
- mult/c $f0, $f15, $f11 # fm : zpl = zp * UP
- mult/c $f0, $f12, $f1 # fm : $f1 = zp * zmi
- mult/c $f0, $f11, $f15 # fm : $f15 = zp * zpl
-
- subt $f1, $f16, $f13 # fa : y1 = zp*zmi - x
- subt $f15, $f16, $f15 # fa : y2 = zp*zpl - x
-
- fcmovge $f13, $f12, $f0 # res = (y1 >= 0) ? zmi : res
- fcmovlt $f15, $f11, $f0 # res = (y2 < 0) ? zpl : res
-
- ret
-
-$negative:
- lda t1, -1
- stq t1, K
- lda t1, EDOM
- stl t1, errno
-#ifdef _LIBC_REENTRANT
- jsr ra, __errno_location
- lda t1, -1
- ldq ra, 0(sp)
- stl t1, 0(v0)
-#endif
- ldt $f0, K # res = (double) 0xffffffffffffffff
- addq sp, FSIZE, sp
- ret
-
- END(__sqrt)
-
-weak_alias(__sqrt, sqrt)
-
-#endif /* !_IEEE_FP */
diff --git a/libio/_G_config.h b/sysdeps/generic/_G_config.h
index 84a552b41e..84a552b41e 100644
--- a/libio/_G_config.h
+++ b/sysdeps/generic/_G_config.h
diff --git a/sysdeps/generic/stpcpy.c b/sysdeps/generic/stpcpy.c
index 9800ace993..0bf84cc700 100644
--- a/sysdeps/generic/stpcpy.c
+++ b/sysdeps/generic/stpcpy.c
@@ -16,6 +16,10 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <string.h>
#ifndef weak_alias
diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c
index 5c3f27a8c1..02a3d47669 100644
--- a/sysdeps/libm-ieee754/w_gamma.c
+++ b/sysdeps/libm-ieee754/w_gamma.c
@@ -30,10 +30,12 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
#endif
{
double y;
+#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_)
y = __ieee754_lgamma_r(x,&signgam);
else
{
+#endif
int local_signgam;
y = __ieee754_gamma_r(x,&local_signgam);
if (local_signgam < 0) y = -y;
diff --git a/sysdeps/libm-ieee754/w_gammaf.c b/sysdeps/libm-ieee754/w_gammaf.c
index 5988e54a60..7d78a52908 100644
--- a/sysdeps/libm-ieee754/w_gammaf.c
+++ b/sysdeps/libm-ieee754/w_gammaf.c
@@ -28,10 +28,12 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
#endif
{
float y;
+#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_)
y = __ieee754_lgammaf_r(x,&signgam);
else
{
+#endif
int local_signgam;
y = __ieee754_gammaf_r(x,&local_signgam);
if (local_signgam < 0) y = -y;
diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c
index 0107d551b7..1b4ae2cc7b 100644
--- a/sysdeps/libm-ieee754/w_gammal.c
+++ b/sysdeps/libm-ieee754/w_gammal.c
@@ -33,10 +33,12 @@ static char rcsid[] = "$NetBSD: $";
#endif
{
long double y;
+#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_)
y = __ieee754_lgammal_r(x,&signgam);
else
{
+#endif
int local_signgam;
y = __ieee754_gammal_r(x,&local_signgam);
if (local_signgam < 0) y = -y;
diff --git a/sysdeps/m68k/Makefile b/sysdeps/m68k/Makefile
index 0f811bc62e..a056360ac6 100644
--- a/sysdeps/m68k/Makefile
+++ b/sysdeps/m68k/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
+# Copyright (C) 1993, 1994, 1996, 1997 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
@@ -25,6 +25,8 @@ endif
asm-CPPFLAGS += $(m68k-syntax-flag)
+pic-ccflag = -fpic
+
# Make sure setjmp.c is compiled with a frame pointer
CFLAGS-setjmp.c := -fno-omit-frame-pointer
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 75434cd750..44eefb20f5 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -56,8 +56,8 @@ static inline Elf32_Addr
elf_machine_load_address (void)
{
Elf32_Addr addr;
- asm ("1: lea 1b(%%pc), %0\n"
- " sub.l 1b@GOTPC(%%pc), %0"
+ asm ("lea _dl_start(%%pc), %0\n\t"
+ "sub.l _dl_start@GOTPC(%%pc), %0"
: "=a" (addr));
return addr;
}
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
new file mode 100644
index 0000000000..8dc9221519
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -0,0 +1,67 @@
+/* This file is needed by libio to define various configuration parameters.
+ These are always the same in the GNU C library. */
+
+#ifndef _G_config_h
+#define _G_config_h 1
+
+/* Define types for libio in terms of the standard internal type names. */
+
+#include <bits/types.h>
+#define __need_size_t
+#define __need_wint_t
+#include <stddef.h>
+#ifndef _WINT_T
+/* Integral type unchanged by default argument promotions that can
+ hold any value corresponding to members of the extended character
+ set, as well as at least one value that does not correspond to any
+ member of the extended character set. */
+#define _WINT_T
+typedef unsigned int wint_t;
+#endif
+#define _G_size_t size_t
+#define _G_fpos_t __off_t
+#define _G_ssize_t __ssize_t
+#define _G_off_t __off_t
+#define _G_pid_t __pid_t
+#define _G_uid_t __uid_t
+#define _G_wint_t wint_t
+
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+#define _G_HAVE_BOOL 1
+
+
+/* These library features are always available in the GNU C library. */
+#define _G_HAVE_ATEXIT 1
+#define _G_HAVE_SYS_CDEFS 1
+#define _G_HAVE_SYS_WAIT 1
+#define _G_NEED_STDARG_H 1
+#define _G_va_list __gnuc_va_list
+
+#define _G_HAVE_PRINTF_FP 1
+#define _G_HAVE_MMAP 1
+#define _G_HAVE_LONG_DOUBLE_IO 1
+
+/* This is defined by <bits/stat.h> if `st_blksize' exists. */
+#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
+
+#define _G_BUFSIZ 8192
+
+/* These are the vtbl details for ELF. */
+#define _G_NAMES_HAVE_UNDERSCORE 0
+#define _G_VTABLE_LABEL_HAS_LENGTH 1
+#define _G_USING_THUNKS
+#define _G_VTABLE_LABEL_PREFIX "__vt_"
+#define _G_VTABLE_LABEL_PREFIX_ID __vt_
+
+
+#if defined (__cplusplus) || defined (__STDC__)
+#define _G_ARGS(ARGLIST) ARGLIST
+#else
+#define _G_ARGS(ARGLIST) ()
+#endif
+
+#endif /* _G_config.h */
diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c
index b3c8aa3f42..91f420163e 100644
--- a/termios/cfsetspeed.c
+++ b/termios/cfsetspeed.c
@@ -102,7 +102,7 @@ static struct speed_struct
/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */
-void
+int
cfsetspeed (struct termios *termios_p, speed_t speed)
{
size_t cnt;
@@ -112,14 +112,16 @@ cfsetspeed (struct termios *termios_p, speed_t speed)
{
cfsetispeed (termios_p, speed);
cfsetospeed (termios_p, speed);
- return;
+ return 0;
}
else if (speed == speeds[cnt].value)
{
cfsetispeed (termios_p, speeds[cnt].internal);
cfsetospeed (termios_p, speeds[cnt].internal);
- return;
+ return 0;
}
__set_errno (EINVAL);
+
+ return -1;
}
diff --git a/termios/termios.h b/termios/termios.h
index 342b0607a2..a55ddbc7a2 100644
--- a/termios/termios.h
+++ b/termios/termios.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 96, 97 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
@@ -51,7 +51,7 @@ extern int cfsetispeed __P ((struct termios *__termios_p, speed_t __speed));
#ifdef __USE_BSD
/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
-extern void cfsetspeed __P ((struct termios *__termios_p, speed_t __speed));
+extern int cfsetspeed __P ((struct termios *__termios_p, speed_t __speed));
#endif
diff --git a/time/africa b/time/africa
index 2ea89bd5e0..5c9608ceaa 100644
--- a/time/africa
+++ b/time/africa
@@ -1,4 +1,4 @@
-# @(#)africa 7.18
+# @(#)africa 7.19
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -27,85 +27,6 @@
# Derek Howse, Greenwich time and the discovery of the longitude,
# Oxford University Press (1980).
#
-# I added so many Zone names that the old, mostly flat name space was unwieldy.
-# So I renamed the Zones to have the form AREA/LOCATION, where
-# AREA is the name of a continent or ocean, and
-# LOCATION is the name of a specific location within that region.
-# For example, the old zone name `Egypt' is now `Africa/Cairo'.
-#
-# Here are the general rules I used for choosing location names,
-# in decreasing order of importance:
-#
-# Use only valid Posix file names. Use only Ascii letters, digits, `.',
-# `-' and `_'. Do not exceed 14 characters or start with `-'.
-# E.g. prefer `Brunei' to `Bandar_Seri_Begawan'.
-# Include at least one location per time zone rule set per country.
-# One such location is enough.
-# If all the clocks in a country's region have agreed since 1970,
-# don't bother to include more than one location
-# even if subregions' clocks disagreed before 1970.
-# Otherwise these tables would become annoyingly large.
-# If a name is ambiguous, use a less ambiguous alternative;
-# e.g. many cities are named San Jose and Georgetown, so
-# prefer `Costa_Rica' to `San_Jose' and `Guyana' to `Georgetown'.
-# Keep locations compact. Use cities or small islands, not countries
-# or regions, so that any future time zone changes do not split
-# locations into different time zones. E.g. prefer `Paris'
-# to `France', since France has had multiple time zones.
-# Use traditional English spelling, e.g. prefer `Rome' to `Roma', and
-# prefer `Athens' to the true name (which uses Greek letters).
-# The Posix file name restrictions encourage this rule.
-# Use the most populous among locations in a country's time zone,
-# e.g. prefer `Shanghai' to `Beijing'. Among locations with
-# similar populations, pick the best-known location,
-# e.g. prefer `Rome' to `Milan'.
-# Use the singular form, e.g. prefer `Canary' to `Canaries'.
-# Omit common suffixes like `_Islands' and `_City', unless that
-# would lead to ambiguity. E.g. prefer `Cayman' to
-# `Cayman_Islands' and `Guatemala' to `Guatemala_City',
-# but prefer `Mexico_City' to `Mexico' because the country
-# of Mexico has several time zones.
-# Use `_' to represent a space.
-# Omit `.' from abbreviations in names, e.g. prefer `St_Helena'
-# to `St._Helena'.
-#
-# For time zone abbreviations like `EST' I used the following rules,
-# in decreasing order of importance:
-#
-# Use abbreviations that consist of 3 or more upper-case Ascii letters,
-# except use "___" for locations while uninhabited.
-# Posix.1 requires at least 3 characters, and the restriction to
-# upper-case Ascii letters follows most traditions.
-# Previous editions of this database also used characters like
-# ' ' and '?', but these characters have a special meaning to
-# the shell and cause commands like
-# set `date`
-# to have unexpected effects. In theory, the character set could
-# be !%./@A-Z^_a-z{}, but these tables use only upper-case
-# Ascii letters (and "___").
-# Use abbreviations that are in common use among English-speakers,
-# e.g. `EST' for Eastern Standard Time in North America.
-# We assume that applications translate them to other languages
-# as part of the normal localization process; for example,
-# a French application might translate `EST' to `HNE'.
-# For zones whose times are taken from a city's longitude, use the
-# traditional xMT notation, e.g. `PMT' for Paris Mean Time.
-# The only name like this in current use is `GMT'.
-# If there is no common English abbreviation, abbreviate the English
-# translation of the usual phrase used by native speakers.
-# If this is not available or is a phrase mentioning the country
-# (e.g. ``Cape Verde Time''), then:
-#
-# When a country has a single or principal time zone region,
-# append `T' to the country's ISO code, e.g. `CVT' for
-# Cape Verde Time. For summer time append `ST';
-# for double summer time append `DST'; etc.
-# When a country has multiple time zones, take the first three
-# letters of an English place name identifying each zone
-# and then append `T', `ST', etc. as before;
-# e.g. `MOSST' for MOScow Summer Time.
-#
-#
# For Africa I invented the following time zone abbreviations.
# LMT Local Mean Time
# -1:00 AAT Atlantic Africa Time (no longer used)
diff --git a/time/europe b/time/europe
index c011424bdc..2948ba1caf 100644
--- a/time/europe
+++ b/time/europe
@@ -1,4 +1,4 @@
-# @(#)europe 7.45
+# @(#)europe 7.46
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -630,18 +630,18 @@
# came into force on 16 November. It restates the dates from the EC
# seventh Summer Time Directive....
#
-# From Peter Ilieve <peter@aldie.co.uk> (1997-03-28):
-# The [European] Transport Council discussed the proposed Eighth Directive
-# on 11 March and agreed [to] it, so it moves forward to the next stage,
-# from a Commission proposal to a Common Position.... What this means is:
-#
-# - The eighth directive proposal rules have been accepted.
-# These are the same as the current rules (last Sunday in March and last
-# Sunday in October). The rules will run until 2001.
-#
-# - The French have had their request to abandon summer time turned down.
-# They have been promised some sort of review in 1999 which might change
-# the rules for 2000 and 2001.
+# From Peter Ilieve <peter@aldie.co.uk> (1997-08-06):
+# I now have a copy of the ... Eighth Directive 97/44/EC of the European
+# Parliament and of the Council of 22 July 1997 on summer-time arrangements.
+# It runs for 4 years, 1998--2001, and confirms the current rules of
+# last Sunday in March to last Sunday in October....
+# The directive does not apply in overseas territories of the Member States.
+# It says the Commission should produce a proposal for 2002 and beyond
+# by 1 Jan 2000 and this should be adopted by 1 Jan 2001. I doubt that
+# this will happen though....
+# There is no mention of the French desire to abandon the whole idea.
+# France has had a change of government recently so maybe it will
+# be quietly dropped.
# From Peter Ilieve <peter@memex.co.uk> (1994-03-28):
# The [GB-Eire] end date of 22 October [1995] conflicts with your current rule
@@ -667,12 +667,12 @@
# Also, for lack of other data, we'll follow Shanks for Eire in 1940-1948.
#
# Given Peter Ilieve's comments, the following claims by Shanks are incorrect:
-# * Wales did not switch from GMT to daylight savings time until
+# * Wales did not switch from GMT to daylight saving time until
# 1921 Apr 3, when they began to conform with the rest of Great Britain.
# Actually, Wales was identical after 1880.
# * Eire had two transitions on 1916 Oct 1.
# It actually just had one transition.
-# * Northern Ireland used single daylight savings time throughout WW II.
+# * Northern Ireland used single daylight saving time throughout WW II.
# Actually, it conformed to Britain.
# * GB-Eire changed standard time to 1 hour ahead of GMT on 1968-02-18.
# Actually, that date saw the usual switch to summer time.
@@ -681,7 +681,7 @@
# The following claims by Shanks are possible though doubtful;
# we'll ignore them for now.
# * Jersey, Guernsey, and the Isle of Man did not switch from GMT
-# to daylight savings time until 1921 Apr 3, when they began to
+# to daylight saving time until 1921 Apr 3, when they began to
# conform with Great Britain.
# * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00.
#
@@ -1047,7 +1047,7 @@ Zone Europe/Sarajevo 1:13:40 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
- 1:00 - CET 1982 Oct 11
+ 1:00 - CET 1982 Nov 27
1:00 EU CE%sT
# Bulgaria
@@ -1073,7 +1073,7 @@ Zone Europe/Zagreb 1:03:52 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
- 1:00 - CET 1982 Oct 11
+ 1:00 - CET 1982 Nov 27
1:00 EU CE%sT
# Czech Republic
@@ -1572,7 +1572,7 @@ Zone Europe/Skopje 1:25:44 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
- 1:00 - CET 1982 Oct 11
+ 1:00 - CET 1982 Nov 27
1:00 EU CE%sT
# Malta
@@ -1968,7 +1968,7 @@ Zone Europe/Ljubljana 0:58:04 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
- 1:00 - CET 1982 Oct 11
+ 1:00 - CET 1982 Nov 27
1:00 EU CE%sT
# Spain
@@ -2209,9 +2209,9 @@ Zone Europe/Belgrade 1:22:00 - LMT 1884
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
# Metod Kozelj <metod.kozelj@rzs-hm.si> reports that the legal date of
-# transition to EU rules was 1982-10-11, for all of Yugoslavia at the time.
+# transition to EU rules was 1982-11-27, for all of Yugoslavia at the time.
# Shanks doesn't give as much detail, so go with Kozelj.
- 1:00 - CET 1982 Oct 11
+ 1:00 - CET 1982 Nov 27
1:00 EU CE%sT
###############################################################################
diff --git a/time/iso3166.tab b/time/iso3166.tab
index b5237783c4..6eb4d318db 100644
--- a/time/iso3166.tab
+++ b/time/iso3166.tab
@@ -7,6 +7,9 @@
# 2. The usual English name for the country,
# chosen so that alphabetic sorting of subsets produces helpful lists.
#
+# For France in Europe, we follow common practice and use FR,
+# even though FX might be more technically correct.
+#
# Columns are separated by a single tab.
# The table is sorted by country code.
#
@@ -86,6 +89,7 @@ FK Falkland Islands
FM Micronesia
FO Faeroe Islands
FR France
+FX France, Metropolitan
GA Gabon
GB Britain (UK)
GD Grenada
diff --git a/time/northamerica b/time/northamerica
index b70cb900c0..635c4ef180 100644
--- a/time/northamerica
+++ b/time/northamerica
@@ -1,4 +1,4 @@
-# @(#)northamerica 7.31
+# @(#)northamerica 7.32
# also includes Central America and the Caribbean
# This data is by no means authoritative; if you think you know better,
@@ -1249,8 +1249,11 @@ Zone America/Martinique -4:04:20 - LMT 1890 # Fort-de-France
-4:00 - AST
# Montserrat
+# From Paul Eggert (1997-08-31):
+# Recent volcanic eruptions have forced evacuation of Plymouth, the capital.
+# Luckily, Olveston, the current de facto capital, has the same longitude.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Montserrat -4:08:52 - LMT 1911 Jul 1 0:01 # Plymouth
+Zone America/Montserrat -4:08:52 - LMT 1911 Jul 1 0:01 # Olveston
-4:00 - AST
# Nicaragua
diff --git a/time/southamerica b/time/southamerica
index 927f71638a..09e0aa6d28 100644
--- a/time/southamerica
+++ b/time/southamerica
@@ -1,4 +1,4 @@
-# @(#)southamerica 7.17
+# @(#)southamerica 7.18
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -533,7 +533,9 @@ Rule Uruguay 1989 only - Mar 12 0:00 0 -
Rule Uruguay 1989 only - Oct 29 0:00 1:00 S
Rule Uruguay 1990 1992 - Mar Sun>=1 0:00 0 -
Rule Uruguay 1990 1991 - Oct Sun>=21 0:00 1:00 S
-Rule Uruguay 1992 1993 - Oct Sun>=15 0:00 1:00 S
+# Shanks's 4th edition (1995) says no DST was observed in 1990/1 and 1991/2,
+# and that 1992/3's DST was from 10-25 to 03-01. Go with IATA.
+Rule Uruguay 1992 only - Oct 18 0:00 1:00 S
Rule Uruguay 1993 only - Feb 28 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28
diff --git a/time/zone.tab b/time/zone.tab
index 48b32373cc..df4c157788 100644
--- a/time/zone.tab
+++ b/time/zone.tab
@@ -231,7 +231,7 @@ MO +2214+11335 Asia/Macao
MP +1512+14545 Pacific/Saipan
MQ +1436-06105 America/Martinique
MR +1806-01557 Africa/Nouakchott
-MS +1642-06213 America/Montserrat
+MS +1644-06213 America/Montserrat
MT +3554+01431 Europe/Malta
MU -2010+05730 Indian/Mauritius
MV +0410+07330 Indian/Maldives