1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
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.
This commit is contained in:
Ulrich Drepper
1997-09-05 01:43:20 +00:00
parent 800d775e42
commit 26b4d76671
91 changed files with 1131 additions and 670 deletions

155
ChangeLog
View File

@ -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> 1997-08-29 21:45 Ulrich Drepper <drepper@cygnus.com>
* sunrpc/auth_des.c: New file. Copied from former secure_rpc add-on. * sunrpc/auth_des.c: New file. Copied from former secure_rpc add-on.

View File

@ -388,7 +388,7 @@ rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(dbobjdir
mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math) mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db) dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
else else
link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
endif endif
@ -537,8 +537,10 @@ ifeq (yes,$(build-shared))
# The PIC object files are named foo.os. # The PIC object files are named foo.os.
object-suffixes += .os object-suffixes += .os
CPPFLAGS-.os = -DPIC CPPFLAGS-.os = -DPIC
CFLAGS-.os = -fPIC -fno-common CFLAGS-.os = $(pic-ccflag) -fno-common
libtype.os := lib%_pic.a libtype.os := lib%_pic.a
# This can be changed by a sysdep makefile
pic-ccflag = -fPIC
endif endif
ifeq (yes,$(build-profile)) ifeq (yes,$(build-profile))
# Under --enable-profile, we will build a static library of profiled objects. # Under --enable-profile, we will build a static library of profiled objects.

View File

@ -54,8 +54,8 @@ endif
subdirs = csu assert ctype db2 locale intl catgets math setjmp signal stdlib \ subdirs = csu assert ctype db2 locale intl catgets math setjmp signal stdlib \
stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \ stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \
posix io termios resource misc socket sysvipc gmon gnulib \ posix io termios resource misc socket sysvipc gmon gnulib \
wctype manual shadow md5-crypt nss $(sysdep-subdirs) po argp \ wctype manual shadow md5-crypt po argp $(add-ons) nss \
$(add-ons) $(binfmt-subdir) $(sysdep-subdirs) $(binfmt-subdir)
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63. export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
# The mach and hurd subdirectories have many generated header files which # The mach and hurd subdirectories have many generated header files which

View File

@ -46,6 +46,8 @@ stdio = @stdio@
add-ons = @subdirs@ add-ons = @subdirs@
cross-compiling = @cross_compiling@ cross-compiling = @cross_compiling@
LDAP = @LDAP@
# Build tools. # Build tools.
CC = @CC@ CC = @CC@
BUILD_CC = @BUILD_CC@ BUILD_CC = @BUILD_CC@

13
configure vendored
View File

@ -2161,6 +2161,18 @@ default) stdio=stdio ;;
esac esac
echo "$ac_t""$stdio" 1>&6 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_release@%$uname_release%g
s%@uname_version@%$uname_version%g s%@uname_version@%$uname_version%g
s%@stdio@%$stdio%g s%@stdio@%$stdio%g
s%@LDAP@%$LDAP%g
s%@libc_cv_slibdir@%$libc_cv_slibdir%g s%@libc_cv_slibdir@%$libc_cv_slibdir%g
s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g

View File

@ -798,6 +798,17 @@ default) stdio=stdio ;;
esac esac
AC_MSG_RESULT($stdio) 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_slibdir)
AC_SUBST(libc_cv_sysconfdir) AC_SUBST(libc_cv_sysconfdir)
AC_SUBST(libc_cv_rootsbindir) AC_SUBST(libc_cv_rootsbindir)

View File

@ -65,6 +65,7 @@ __bt_free(t, h)
h->prevpg = P_INVALID; h->prevpg = P_INVALID;
h->nextpg = t->bt_free; h->nextpg = t->bt_free;
t->bt_free = h->pgno; t->bt_free = h->pgno;
F_SET(t, B_METADIRTY);
/* Make sure the page gets written back. */ /* Make sure the page gets written back. */
return (mpool_put(t->bt_mp, h, MPOOL_DIRTY)); 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) { (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
*npg = t->bt_free; *npg = t->bt_free;
t->bt_free = h->nextpg; t->bt_free = h->nextpg;
F_SET(t, B_METADIRTY);
return (h); return (h);
} }
return (mpool_new(t->bt_mp, npg)); return (mpool_new(t->bt_mp, npg));

View File

@ -19,7 +19,7 @@
# #
# Sub-makefile for libdb. # 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. # 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_deadlock: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_dump: $(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_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_recover: $(objpfx)libdb.so$(libdb.so-version)
$(objpfx)db_stat: $(objpfx)libdb.so$(libdb.so-version) $(objpfx)db_stat: $(objpfx)libdb.so$(libdb.so-version)
else else
@ -100,6 +101,7 @@ $(objpfx)db_checkpoint: $(objpfx)libdb.a
$(objpfx)db_deadlock: $(objpfx)libdb.a $(objpfx)db_deadlock: $(objpfx)libdb.a
$(objpfx)db_dump: $(objpfx)libdb.a $(objpfx)db_dump: $(objpfx)libdb.a
$(objpfx)db_load: $(objpfx)libdb.a $(objpfx)db_load: $(objpfx)libdb.a
$(objpfx)db_printlog: $(objpfx)libdb.a
$(objpfx)db_recover: $(objpfx)libdb.a $(objpfx)db_recover: $(objpfx)libdb.a
$(objpfx)db_stat: $(objpfx)libdb.a $(objpfx)db_stat: $(objpfx)libdb.a
endif endif

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -157,14 +157,12 @@ __bam_upstat(dbp)
if (F_ISSET(dbp, DB_AM_INMEM | DB_AM_RDONLY)) if (F_ISSET(dbp, DB_AM_INMEM | DB_AM_RDONLY))
return; return;
/* Lock the page. */
if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &mlock) != 0)
return;
flags = 0; flags = 0;
pgno = PGNO_METADATA; 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) { if (__bam_pget(dbp, (PAGE **)&meta, &pgno, 0) == 0) {
/* Log the change. */ /* Log the change. */
if (DB_LOGGING(dbp) && if (DB_LOGGING(dbp) &&

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -103,7 +103,7 @@ __bam_cmp(dbp, k1, e)
bo = NULL; bo = NULL;
if (TYPE(h) == P_LBTREE) { if (TYPE(h) == P_LBTREE) {
bk = GET_BKEYDATA(h, e->indx); bk = GET_BKEYDATA(h, e->indx);
if (bk->type == B_OVERFLOW) if (B_TYPE(bk->type) == B_OVERFLOW)
bo = (BOVERFLOW *)bk; bo = (BOVERFLOW *)bk;
else { else {
memset(&k2, 0, sizeof(k2)); memset(&k2, 0, sizeof(k2));
@ -112,7 +112,7 @@ __bam_cmp(dbp, k1, e)
} }
} else { } else {
bi = GET_BINTERNAL(h, e->indx); bi = GET_BINTERNAL(h, e->indx);
if (bi->type == B_OVERFLOW) if (B_TYPE(bi->type) == B_OVERFLOW)
bo = (BOVERFLOW *)(bi->data); bo = (BOVERFLOW *)(bi->data);
else { else {
memset(&k2, 0, sizeof(k2)); memset(&k2, 0, sizeof(k2));

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -69,6 +69,8 @@ __bam_mswap(pg)
u_int8_t *p; u_int8_t *p;
p = (u_int8_t *)pg; p = (u_int8_t *)pg;
/* Swap the meta-data information. */
SWAP32(p); /* lsn.file */ SWAP32(p); /* lsn.file */
SWAP32(p); /* lsn.offset */ SWAP32(p); /* lsn.offset */
SWAP32(p); /* pgno */ SWAP32(p); /* pgno */
@ -79,5 +81,19 @@ __bam_mswap(pg)
SWAP32(p); /* minkey */ SWAP32(p); /* minkey */
SWAP32(p); /* free */ SWAP32(p); /* free */
SWAP32(p); /* flags */ 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); return (0);
} }

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #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. */ /* Set the intent-to-delete flag on the page and in all cursors. */
if (cp->dpgno == PGNO_INVALID) if (cp->dpgno == PGNO_INVALID)
GET_BKEYDATA(h, indx + O_INDX)->deleted = 1; B_DSET(GET_BKEYDATA(h, indx + O_INDX)->type);
else else
GET_BKEYDATA(h, indx)->deleted = 1; B_DSET(GET_BKEYDATA(h, indx)->type);
(void)__bam_ca_delete(dbp, pgno, indx, NULL); (void)__bam_ca_delete(dbp, pgno, indx, NULL);
ret = memp_fput(dbp->mpf, h, DB_MPOOL_DIRTY); 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 it's an empty page or a deleted record, go to the next one. */
if (NUM_ENT(cp->page) == 0 || 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) if ((ret = __bam_c_next(dbp, cp, 0)) != 0)
return (ret); return (ret);
@ -653,7 +653,7 @@ __bam_c_first(dbp, cp)
/* If it's a deleted record, go to the next one. */ /* If it's a deleted record, go to the next one. */
if (cp->dpgno != PGNO_INVALID && 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) if ((ret = __bam_c_next(dbp, cp, 0)) != 0)
return (ret); return (ret);
return (0); 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 it's an empty page or a deleted record, go to the previous one. */
if (NUM_ENT(cp->page) == 0 || 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) if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret); return (ret);
@ -704,7 +704,7 @@ __bam_c_last(dbp, cp)
/* If it's a deleted record, go to the previous one. */ /* If it's a deleted record, go to the previous one. */
if (cp->dpgno != PGNO_INVALID && 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) if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret); return (ret);
return (0); return (0);
@ -793,9 +793,9 @@ __bam_c_next(dbp, cp, initial_move)
/* Ignore deleted records. */ /* Ignore deleted records. */
if (dbp->type == DB_BTREE && if (dbp->type == DB_BTREE &&
((cp->dpgno == PGNO_INVALID && ((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 && (cp->dpgno != PGNO_INVALID &&
GET_BKEYDATA(cp->page, indx)->deleted))) { B_DISSET(GET_BKEYDATA(cp->page, indx)->type)))) {
indx += adjust; indx += adjust;
continue; continue;
} }
@ -908,9 +908,9 @@ __bam_c_prev(dbp, cp)
indx -= adjust; indx -= adjust;
if (dbp->type == DB_BTREE && if (dbp->type == DB_BTREE &&
((cp->dpgno == PGNO_INVALID && ((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 && (cp->dpgno != PGNO_INVALID &&
GET_BKEYDATA(cp->page, indx)->deleted))) B_DISSET(GET_BKEYDATA(cp->page, indx)->type))))
continue; 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 it's a deleted record, go to the next or previous one. */
if (cp->dpgno != PGNO_INVALID && 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 (flags == S_KEYLAST) {
if ((ret = __bam_c_prev(dbp, cp)) != 0) if ((ret = __bam_c_prev(dbp, cp)) != 0)
return (ret); return (ret);
@ -1027,7 +1027,7 @@ __bam_ovfl_chk(dbp, cp, indx, to_end)
/* Check for an overflow entry. */ /* Check for an overflow entry. */
bo = GET_BOVERFLOW(cp->page, indx); bo = GET_BOVERFLOW(cp->page, indx);
if (bo->type != B_DUPLICATE) if (B_TYPE(bo->type) != B_DUPLICATE)
return (0); return (0);
/* /*

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -107,7 +107,7 @@ __bam_delete(argdbp, txn, key, flags)
break; break;
for (; cnt > 0; --cnt, ++t->lstat.bt_deleted) for (; cnt > 0; --cnt, ++t->lstat.bt_deleted)
if (__bam_ca_delete(dbp, h->pgno, indx, NULL) != 0) { 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; indx += P_INDX;
} else if ((ret = __bam_ditem(dbp, h, indx)) != 0 || } else if ((ret = __bam_ditem(dbp, h, indx)) != 0 ||
(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; stack = 1;
/* If the record has already been deleted, we couldn't have found it. */ /* 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; ret = DB_KEYEMPTY;
goto done; goto done;
} }
@ -193,14 +193,13 @@ __ram_delete(argdbp, txn, key, flags)
if ((ret = __bam_ditem(dbp, h, indx)) != 0) if ((ret = __bam_ditem(dbp, h, indx)) != 0)
goto err; goto err;
bk.deleted = 1; B_TSET(bk.type, B_KEYDATA, 1);
bk.type = B_KEYDATA;
bk.len = 0; bk.len = 0;
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
hdr.data = &bk; hdr.data = &bk;
hdr.size = SSZA(BKEYDATA, data); hdr.size = SSZA(BKEYDATA, data);
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.data = (char *) ""; data.data = (char *)"";
data.size = 0; data.size = 0;
if ((ret = __db_pitem(dbp, if ((ret = __db_pitem(dbp,
h, indx, BKEYDATA_SIZE(0), &hdr, &data)) != 0) h, indx, BKEYDATA_SIZE(0), &hdr, &data)) != 0)
@ -263,7 +262,7 @@ __bam_ditem(dbp, h, indx)
switch (TYPE(h)) { switch (TYPE(h)) {
case P_IBTREE: case P_IBTREE:
bi = GET_BINTERNAL(h, indx); bi = GET_BINTERNAL(h, indx);
switch (bi->type) { switch (B_TYPE(bi->type)) {
case B_DUPLICATE: case B_DUPLICATE:
case B_OVERFLOW: case B_OVERFLOW:
nbytes = BINTERNAL_SIZE(bi->len); nbytes = BINTERNAL_SIZE(bi->len);
@ -298,14 +297,14 @@ __bam_ditem(dbp, h, indx)
/* FALLTHROUGH */ /* FALLTHROUGH */
case P_LRECNO: case P_LRECNO:
bk = GET_BKEYDATA(h, indx); bk = GET_BKEYDATA(h, indx);
switch (bk->type) { switch (B_TYPE(bk->type)) {
case B_DUPLICATE: case B_DUPLICATE:
case B_OVERFLOW: case B_OVERFLOW:
nbytes = BOVERFLOW_SIZE; nbytes = BOVERFLOW_SIZE;
offpage: /* Delete duplicate/offpage chains. */ offpage: /* Delete duplicate/offpage chains. */
bo = GET_BOVERFLOW(h, indx); bo = GET_BOVERFLOW(h, indx);
if (bo->type == B_DUPLICATE) { if (B_TYPE(bo->type) == B_DUPLICATE) {
if ((ret = if ((ret =
__db_ddup(dbp, bo->pgno, __bam_free)) != 0) __db_ddup(dbp, bo->pgno, __bam_free)) != 0)
return (ret); return (ret);

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -120,7 +120,7 @@ retry: /*
*/ */
replace = 0; replace = 0;
if (exact && flags == DB_NOOVERWRITE) { 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; ret = DB_KEYEXIST;
goto err; goto err;
} }
@ -436,16 +436,14 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
*/ */
bigkey = bigdata = 0; bigkey = bigdata = 0;
if (LF_ISSET(BI_NEWKEY) && key->size > t->bt_ovflsize) { if (LF_ISSET(BI_NEWKEY) && key->size > t->bt_ovflsize) {
kbo.deleted = 0; B_TSET(kbo.type, B_OVERFLOW, 0);
kbo.type = B_OVERFLOW;
kbo.tlen = key->size; kbo.tlen = key->size;
if ((ret = __db_poff(dbp, key, &kbo.pgno, __bam_new)) != 0) if ((ret = __db_poff(dbp, key, &kbo.pgno, __bam_new)) != 0)
goto err; goto err;
bigkey = 1; bigkey = 1;
} }
if (data->size > t->bt_ovflsize) { if (data->size > t->bt_ovflsize) {
dbo.deleted = 0; B_TSET(dbo.type, B_OVERFLOW, 0);
dbo.type = B_OVERFLOW;
dbo.tlen = data->size; dbo.tlen = data->size;
if ((ret = __db_poff(dbp, data, &dbo.pgno, __bam_new)) != 0) if ((ret = __db_poff(dbp, data, &dbo.pgno, __bam_new)) != 0)
goto err; goto err;
@ -472,7 +470,7 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
if (op == DB_CURRENT) { if (op == DB_CURRENT) {
bk = GET_BKEYDATA(h, bk = GET_BKEYDATA(h,
indx + (TYPE(h) == P_LBTREE ? O_INDX : 0)); indx + (TYPE(h) == P_LBTREE ? O_INDX : 0));
if (bk->type == B_OVERFLOW) if (B_TYPE(bk->type) == B_OVERFLOW)
have_bytes = BOVERFLOW_PSIZE; have_bytes = BOVERFLOW_PSIZE;
else else
have_bytes = BKEYDATA_PSIZE(bk->len); 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. * alignment) and do a delete/insert otherwise.
*/ */
if (op == DB_CURRENT && !bigdata && 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; dcopy = 1;
if (have_bytes < need_bytes) if (have_bytes < need_bytes)
needed += need_bytes - have_bytes; needed += need_bytes - have_bytes;
@ -622,9 +620,8 @@ __bam_iitem(dbp, hp, indxp, key, data, op, flags)
__data.size = data->size; __data.size = data->size;
if (LF_ISSET(BI_DELETED)) { if (LF_ISSET(BI_DELETED)) {
B_TSET(__bk.type, B_KEYDATA, 1);
__bk.len = __data.size; __bk.len = __data.size;
__bk.deleted = 1;
__bk.type = B_KEYDATA;
__hdr.data = &__bk; __hdr.data = &__bk;
__hdr.size = SSZA(BKEYDATA, data); __hdr.size = SSZA(BKEYDATA, data);
ret = __db_pitem(dbp, h, indx, 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]) if (indx >= NUM_ENT(h) || h->inp[first] != h->inp[indx])
break; break;
bk = GET_BKEYDATA(h, indx); bk = GET_BKEYDATA(h, indx);
sz += bk->type == B_KEYDATA ? sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE; BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
bk = GET_BKEYDATA(h, indx + O_INDX); 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; BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
} }
@ -716,7 +713,7 @@ __bam_ndup(dbp, h, indx)
/* Copy the entry to the new page. */ /* Copy the entry to the new page. */
bk = GET_BKEYDATA(h, indx); bk = GET_BKEYDATA(h, indx);
hdr.data = bk; hdr.data = bk;
hdr.size = bk->type == B_KEYDATA ? hdr.size = B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_SIZE(bk->len) : BOVERFLOW_SIZE; BKEYDATA_SIZE(bk->len) : BOVERFLOW_SIZE;
if ((ret = if ((ret =
__db_pitem(dbp, cp, cpindx, hdr.size, &hdr, NULL)) != 0) __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. */ /* Put in a new data item that points to the duplicates page. */
bo.deleted = 0; B_TSET(bo.type, B_DUPLICATE, 0);
bo.type = B_DUPLICATE;
bo.pgno = cp->pgno; bo.pgno = cp->pgno;
bo.tlen = 0; bo.tlen = 0;
@ -828,14 +824,14 @@ __bam_partial(dbp, dbt, h, indx)
*/ */
if (indx < NUM_ENT(h)) { if (indx < NUM_ENT(h)) {
bk = GET_BKEYDATA(h, indx + (TYPE(h) == P_LBTREE ? O_INDX : 0)); 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; bo = (BOVERFLOW *)bk;
nbytes = bo->tlen; nbytes = bo->tlen;
} else } else
nbytes = bk->len; nbytes = bk->len;
} else { } else {
bk = &tbk; bk = &tbk;
bk->type = B_KEYDATA; B_TSET(bk->type, B_KEYDATA, 0);
nbytes = bk->len = 0; nbytes = bk->len = 0;
} }
nbytes += dbt->doff + dbt->size + dbt->dlen; nbytes += dbt->doff + dbt->size + dbt->dlen;
@ -856,7 +852,7 @@ __bam_partial(dbp, dbt, h, indx)
memset(t->bt_rdata.data, 0, nbytes); memset(t->bt_rdata.data, 0, nbytes);
tlen = 0; tlen = 0;
if (bk->type == B_OVERFLOW) { if (B_TYPE(bk->type) == B_OVERFLOW) {
/* Take up to doff bytes from the record. */ /* Take up to doff bytes from the record. */
memset(&copy, 0, sizeof(copy)); memset(&copy, 0, sizeof(copy));
if ((ret = __db_goff(dbp, &copy, bo->tlen, if ((ret = __db_goff(dbp, &copy, bo->tlen,

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -749,13 +749,13 @@ __bam_cdel_recover(logp, dbtp, lsnp, redo, info)
cmp_p = log_compare(&LSN(pagep), &argp->lsn); cmp_p = log_compare(&LSN(pagep), &argp->lsn);
if (cmp_p == 0 && redo) { if (cmp_p == 0 && redo) {
/* Need to redo update described. */ /* 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; LSN(pagep) = *lsnp;
modified = 1; modified = 1;
} else if (cmp_n == 0 && !redo) { } else if (cmp_n == 0 && !redo) {
/* Need to undo update described. */ /* 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; LSN(pagep) = argp->lsn;
modified = 1; modified = 1;

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -246,7 +246,7 @@ __ram_get(argdbp, txn, key, data, flags)
indx = t->bt_csp->indx; indx = t->bt_csp->indx;
/* If the record has already been deleted, we couldn't have found it. */ /* 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; ret = DB_KEYEMPTY;
goto done; goto done;
} }
@ -981,7 +981,7 @@ __ram_writeback(dbp)
if ((ret = if ((ret =
__db_write(fd, pad, rp->re_len, &nw)) != 0) __db_write(fd, pad, rp->re_len, &nw)) != 0)
goto err; goto err;
if (nw != (ssize_t) rp->re_len) { if (nw != (ssize_t)rp->re_len) {
ret = EIO; ret = EIO;
goto err; goto err;
} }

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -258,17 +258,17 @@ match: *exactp = 1;
*/ */
if (LF_ISSET(S_DELNO)) { if (LF_ISSET(S_DELNO)) {
if (LF_ISSET(S_DUPLAST)) 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 && indx > 0 &&
h->inp[indx] == h->inp[indx - P_INDX]) h->inp[indx] == h->inp[indx - P_INDX])
indx -= P_INDX; indx -= P_INDX;
else 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) && indx < (db_indx_t)(NUM_ENT(h) - P_INDX) &&
h->inp[indx] == h->inp[indx + P_INDX]) h->inp[indx] == h->inp[indx + P_INDX])
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; goto notfound;
} }

View File

@ -44,7 +44,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #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. * level of the tree is never used, so it doesn't need to be filled in.
*/ */
bi.len = 0; bi.len = 0;
bi.deleted = 0; B_TSET(bi.type, B_KEYDATA, 0);
bi.type = B_KEYDATA;
bi.pgno = lp->pgno; bi.pgno = lp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) { if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(lp); bi.nrecs = __bam_total(lp);
@ -405,7 +404,7 @@ __bam_broot(dbp, rootp, lp, rp)
hdr.data = &bi; hdr.data = &bi;
hdr.size = SSZA(BINTERNAL, data); hdr.size = SSZA(BINTERNAL, data);
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.data = (char *) ""; data.data = (char *)"";
data.size = 0; data.size = 0;
if ((ret = if ((ret =
__db_pitem(dbp, rootp, 0, BINTERNAL_SIZE(0), &hdr, &data)) != 0) __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); child_bi = GET_BINTERNAL(rp, 0);
bi.len = child_bi->len; bi.len = child_bi->len;
bi.deleted = 0; B_TSET(bi.type, child_bi->type, 0);
bi.type = child_bi->type;
bi.pgno = rp->pgno; bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) { if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp); bi.nrecs = __bam_total(rp);
@ -433,18 +431,17 @@ __bam_broot(dbp, rootp, lp, rp)
return (ret); return (ret);
/* Increment the overflow ref count. */ /* 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) __db_ioff(dbp, ((BOVERFLOW *)(child_bi->data))->pgno)) != 0)
return (ret); return (ret);
break; break;
case P_LBTREE: case P_LBTREE:
/* Copy the first key of the child page onto the root page. */ /* Copy the first key of the child page onto the root page. */
child_bk = GET_BKEYDATA(rp, 0); child_bk = GET_BKEYDATA(rp, 0);
switch (child_bk->type) { switch (B_TYPE(child_bk->type)) {
case B_KEYDATA: case B_KEYDATA:
bi.len = child_bk->len; bi.len = child_bk->len;
bi.deleted = 0; B_TSET(bi.type, child_bk->type, 0);
bi.type = child_bk->type;
bi.pgno = rp->pgno; bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) { if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp); bi.nrecs = __bam_total(rp);
@ -461,8 +458,7 @@ __bam_broot(dbp, rootp, lp, rp)
case B_DUPLICATE: case B_DUPLICATE:
case B_OVERFLOW: case B_OVERFLOW:
bi.len = BOVERFLOW_SIZE; bi.len = BOVERFLOW_SIZE;
bi.deleted = 0; B_TSET(bi.type, child_bk->type, 0);
bi.type = child_bk->type;
bi.pgno = rp->pgno; bi.pgno = rp->pgno;
if (F_ISSET(dbp, DB_BT_RECNUM)) { if (F_ISSET(dbp, DB_BT_RECNUM)) {
bi.nrecs = __bam_total(rp); bi.nrecs = __bam_total(rp);
@ -477,7 +473,7 @@ __bam_broot(dbp, rootp, lp, rp)
return (ret); return (ret);
/* Increment the overflow ref count. */ /* 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) __db_ioff(dbp, ((BOVERFLOW *)child_bk)->pgno)) != 0)
return (ret); return (ret);
break; break;
@ -594,8 +590,7 @@ __bam_pinsert(dbp, parent, lchild, rchild)
/* Add a new record for the right page. */ /* Add a new record for the right page. */
bi.len = child_bi->len; bi.len = child_bi->len;
bi.deleted = 0; B_TSET(bi.type, child_bi->type, 0);
bi.type = child_bi->type;
bi.pgno = rchild->pgno; bi.pgno = rchild->pgno;
bi.nrecs = nrecs; bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
@ -609,13 +604,13 @@ __bam_pinsert(dbp, parent, lchild, rchild)
return (ret); return (ret);
/* Increment the overflow ref count. */ /* 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) __db_ioff(dbp, ((BOVERFLOW *)(child_bi->data))->pgno)) != 0)
return (ret); return (ret);
break; break;
case P_LBTREE: case P_LBTREE:
child_bk = GET_BKEYDATA(rchild, 0); child_bk = GET_BKEYDATA(rchild, 0);
switch (child_bk->type) { switch (B_TYPE(child_bk->type)) {
case B_KEYDATA: case B_KEYDATA:
nbytes = BINTERNAL_PSIZE(child_bk->len); nbytes = BINTERNAL_PSIZE(child_bk->len);
nksize = 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) if (ppage->prev_pgno == PGNO_INVALID && off <= 1)
goto noprefix; goto noprefix;
tmp_bk = GET_BKEYDATA(lchild, NUM_ENT(lchild) - P_INDX); 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; goto noprefix;
memset(&a, 0, sizeof(a)); memset(&a, 0, sizeof(a));
a.size = tmp_bk->len; a.size = tmp_bk->len;
@ -643,8 +638,7 @@ noprefix: nksize = child_bk->len;
return (DB_NEEDSPLIT); return (DB_NEEDSPLIT);
bi.len = nksize; bi.len = nksize;
bi.deleted = 0; B_TSET(bi.type, child_bk->type, 0);
bi.type = child_bk->type;
bi.pgno = rchild->pgno; bi.pgno = rchild->pgno;
bi.nrecs = nrecs; bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
@ -665,8 +659,7 @@ noprefix: nksize = child_bk->len;
return (DB_NEEDSPLIT); return (DB_NEEDSPLIT);
bi.len = BOVERFLOW_SIZE; bi.len = BOVERFLOW_SIZE;
bi.deleted = 0; B_TSET(bi.type, child_bk->type, 0);
bi.type = child_bk->type;
bi.pgno = rchild->pgno; bi.pgno = rchild->pgno;
bi.nrecs = nrecs; bi.nrecs = nrecs;
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
@ -680,7 +673,7 @@ noprefix: nksize = child_bk->len;
return (ret); return (ret);
/* Increment the overflow ref count. */ /* 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) __db_ioff(dbp, ((BOVERFLOW *)child_bk)->pgno)) != 0)
return (ret); return (ret);
break; break;
@ -796,21 +789,21 @@ __bam_psplit(dbp, cp, lp, rp, cleft)
for (nbytes = 0, off = 0; off < top && nbytes < half; ++off) for (nbytes = 0, off = 0; off < top && nbytes < half; ++off)
switch (TYPE(pp)) { switch (TYPE(pp)) {
case P_IBTREE: case P_IBTREE:
if (GET_BINTERNAL(pp, off)->type == B_KEYDATA) if (B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA)
nbytes += nbytes +=
BINTERNAL_SIZE(GET_BINTERNAL(pp, off)->len); BINTERNAL_SIZE(GET_BINTERNAL(pp, off)->len);
else else
nbytes += BINTERNAL_SIZE(BOVERFLOW_SIZE); nbytes += BINTERNAL_SIZE(BOVERFLOW_SIZE);
break; break;
case P_LBTREE: case P_LBTREE:
if (GET_BKEYDATA(pp, off)->type == B_KEYDATA) if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)
nbytes += nbytes +=
BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len); BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len);
else else
nbytes += BOVERFLOW_SIZE; nbytes += BOVERFLOW_SIZE;
++off; ++off;
if (GET_BKEYDATA(pp, off)->type == B_KEYDATA) if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)
nbytes += nbytes +=
BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len); BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len);
else else
@ -832,9 +825,9 @@ sort: splitp = off;
* it's a big key, try and find something close by that's not. * it's a big key, try and find something close by that's not.
*/ */
if (TYPE(pp) == P_IBTREE) 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) 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 else
isbigkey = 0; isbigkey = 0;
if (isbigkey) if (isbigkey)
@ -842,8 +835,8 @@ sort: splitp = off;
off = splitp + cnt * adjust; off = splitp + cnt * adjust;
if (off < (db_indx_t)NUM_ENT(pp) && if (off < (db_indx_t)NUM_ENT(pp) &&
((TYPE(pp) == P_IBTREE && ((TYPE(pp) == P_IBTREE &&
GET_BINTERNAL(pp, off)->type == B_KEYDATA) || B_TYPE(GET_BINTERNAL(pp,off)->type) == B_KEYDATA) ||
GET_BKEYDATA(pp, off)->type == B_KEYDATA)) { B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)) {
splitp = off; splitp = off;
break; break;
} }
@ -851,8 +844,8 @@ sort: splitp = off;
continue; continue;
off = splitp - cnt * adjust; off = splitp - cnt * adjust;
if (TYPE(pp) == P_IBTREE ? if (TYPE(pp) == P_IBTREE ?
GET_BINTERNAL(pp, off)->type == B_KEYDATA : B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA :
GET_BKEYDATA(pp, off)->type == B_KEYDATA) { B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA) {
splitp = off; splitp = off;
break; break;
} }
@ -915,7 +908,7 @@ __bam_copy(dbp, pp, cp, nxt, stop)
for (dup = off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) { for (dup = off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) {
switch (TYPE(pp)) { switch (TYPE(pp)) {
case P_IBTREE: case P_IBTREE:
if (GET_BINTERNAL(pp, nxt)->type == B_KEYDATA) if (B_TYPE(GET_BINTERNAL(pp, nxt)->type) == B_KEYDATA)
nbytes = nbytes =
BINTERNAL_SIZE(GET_BINTERNAL(pp, nxt)->len); BINTERNAL_SIZE(GET_BINTERNAL(pp, nxt)->len);
else else
@ -933,7 +926,7 @@ __bam_copy(dbp, pp, cp, nxt, stop)
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case P_LRECNO: case P_LRECNO:
if (GET_BKEYDATA(pp, nxt)->type == B_KEYDATA) if (B_TYPE(GET_BKEYDATA(pp, nxt)->type) == B_KEYDATA)
nbytes = nbytes =
BKEYDATA_SIZE(GET_BKEYDATA(pp, nxt)->len); BKEYDATA_SIZE(GET_BKEYDATA(pp, nxt)->len);
else else

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -140,6 +140,11 @@ __bam_stat(argdbp, spp, db_malloc, flags)
(void)memp_fput(dbp->mpf, meta, 0); (void)memp_fput(dbp->mpf, meta, 0);
(void)__BT_TLPUT(dbp, lock); (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. */ /* Get the root page. */
pgno = PGNO_ROOT; pgno = PGNO_ROOT;
if ((ret = __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_READ, &lock)) != 0) 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. */ /* Get the levels from the root page. */
sp->bt_levels = h->level; sp->bt_levels = h->level;
/* /* Walk the page list, counting things. */
* 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);
for (;;) { for (;;) {
switch (TYPE(h)) { switch (TYPE(h)) {
case P_INVALID: case P_INVALID:

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -43,7 +43,7 @@ static int __db_tmp_open __P((DB_ENV *, char *, int *));
* db_version -- * db_version --
* Return verision information. * Return verision information.
*/ */
const char * char *
db_version(majverp, minverp, patchp) db_version(majverp, minverp, patchp)
int *majverp, *minverp, *patchp; int *majverp, *minverp, *patchp;
{ {
@ -53,7 +53,7 @@ db_version(majverp, minverp, patchp)
*minverp = DB_VERSION_MINOR; *minverp = DB_VERSION_MINOR;
if (patchp != NULL) if (patchp != NULL)
*patchp = DB_VERSION_PATCH; *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; int flags;
{ {
FILE *fp; FILE *fp;
int i_lock, i_log, i_mpool, i_txn, ret; int ret;
char *lp, **p, buf[MAXPATHLEN * 2]; char *lp, **p, buf[MAXPATHLEN * 2];
/* Validate arguments. */ /* Validate arguments. */
@ -94,7 +94,6 @@ db_appinit(db_home, db_config, dbenv, flags)
return (__db_ferr(dbenv, "db_appinit", 1)); return (__db_ferr(dbenv, "db_appinit", 1));
fp = NULL; fp = NULL;
i_lock = i_log = i_mpool = i_txn = 0;
/* Set the database home. */ /* Set the database home. */
if ((ret = __db_home(dbenv, db_home, flags)) != 0) if ((ret = __db_home(dbenv, db_home, flags)) != 0)
@ -117,6 +116,7 @@ db_appinit(db_home, db_config, dbenv, flags)
goto err; goto err;
} }
(void)fclose(fp); (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) #define DB_DEFPERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)
/* Initialize the subsystems. */ /* Initialize the subsystems. */
if (LF_ISSET(DB_INIT_LOCK)) { if (LF_ISSET(DB_INIT_LOCK) && (ret = lock_open(NULL,
if ((ret = lock_open(NULL, LF_ISSET(DB_CREATE | DB_THREAD),
LF_ISSET(DB_CREATE | DB_THREAD), DB_DEFPERM, dbenv, &dbenv->lk_info)) != 0)
DB_DEFPERM, dbenv, &dbenv->lk_info)) != 0) goto err;
goto err; if (LF_ISSET(DB_INIT_LOG) && (ret = log_open(NULL,
i_lock = 1; LF_ISSET(DB_CREATE | DB_THREAD),
} DB_DEFPERM, dbenv, &dbenv->lg_info)) != 0)
if (LF_ISSET(DB_INIT_LOG)) { goto err;
if ((ret = log_open(NULL, if (LF_ISSET(DB_INIT_MPOOL) && (ret = memp_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,
LF_ISSET(DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP | DB_THREAD), LF_ISSET(DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP | DB_THREAD),
DB_DEFPERM, dbenv, &dbenv->mp_info)) != 0) DB_DEFPERM, dbenv, &dbenv->mp_info)) != 0)
goto err; goto err;
i_mpool = 1; if (LF_ISSET(DB_INIT_TXN) && (ret = txn_open(NULL,
} LF_ISSET(DB_CREATE | DB_THREAD | DB_TXN_NOSYNC),
if (LF_ISSET(DB_INIT_TXN)) { DB_DEFPERM, dbenv, &dbenv->tx_info)) != 0)
if ((ret = txn_open(NULL, goto err;
LF_ISSET(DB_CREATE | DB_THREAD | DB_TXN_NOSYNC),
DB_DEFPERM, dbenv, &dbenv->tx_info)) != 0)
goto err;
i_txn = 1;
}
/* Initialize recovery. */ /* Initialize recovery. */
if (LF_ISSET(DB_INIT_TXN)) { if (LF_ISSET(DB_INIT_TXN)) {
@ -195,7 +183,7 @@ db_appinit(db_home, db_config, dbenv, flags)
goto err; goto err;
} }
/* Now run recovery if necessary. */ /* Run recovery if necessary. */
if (LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL) && (ret = if (LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL) && (ret =
__db_apprec(dbenv, LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL))) != 0) __db_apprec(dbenv, LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL))) != 0)
goto err; goto err;
@ -204,14 +192,6 @@ db_appinit(db_home, db_config, dbenv, flags)
err: if (fp != NULL) err: if (fp != NULL)
(void)fclose(fp); (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); (void)db_appexit(dbenv);
return (ret); return (ret);

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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 <time.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#endif #endif
#include "db_int.h" #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 "txn.h"
#include "common_ext.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 -- * __db_apprec --
* Perform recovery. * Perform recovery.
@ -45,30 +52,34 @@ __db_apprec(dbenv, flags)
DB_LOG *lp; DB_LOG *lp;
DB_LSN ckp_lsn, first_lsn, lsn, tmp_lsn; DB_LSN ckp_lsn, first_lsn, lsn, tmp_lsn;
time_t now; time_t now;
int first_flag, ret, tret; int first_flag, ret;
void *txninfo; void *txninfo;
ZERO_LSN(ckp_lsn);
/* Initialize the transaction list. */ /* Initialize the transaction list. */
if ((ret = __db_txnlist_init(&txninfo)) != 0) if ((ret = __db_txnlist_init(&txninfo)) != 0)
return (ret); return (ret);
/* /*
* Read forward through the log opening the appropriate files * Read forward through the log, opening the appropriate files so that
* so that we can call recovery routines. In general, we start * we can call recovery routines. In general, we start at the last
* at the last checkpoint prior to the last checkpointed LSN. * checkpoint prior to the last checkpointed LSN. For catastrophic
* For catastrophic recovery, we begin at the first LSN that * recovery, we begin at the first LSN that appears in any log file
* appears in any log file (log figures this out for us when * (log_get figures this out for us when we pass it the DB_FIRST flag).
* we pass it the DB_FIRST flag).
*/ */
lp = dbenv->lg_info; lp = dbenv->lg_info;
if (LF_ISSET(DB_RECOVER_FATAL)) if (LF_ISSET(DB_RECOVER_FATAL))
first_flag = DB_FIRST; first_flag = DB_FIRST;
else else {
first_flag = __log_findckp(lp, &lsn) != 0 ? DB_FIRST : DB_SET; 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)); 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) { if ((ret = log_get(lp, &lsn, &data, first_flag)) != 0) {
__db_err(dbenv, "Failure: unable to get log record"); __db_err(dbenv, "Failure: unable to get log record");
if (first_flag == DB_SET) if (first_flag == DB_SET)
@ -80,35 +91,55 @@ __db_apprec(dbenv, flags)
} }
first_lsn = lsn; first_lsn = lsn;
for (; ret == 0; for (;;) {
ret = log_get(dbenv->lg_info, &lsn, &data, DB_NEXT)) ret = __db_dispatch(lp, &data, &lsn, TXN_OPENFILES, txninfo);
if ((tret = __db_dispatch(lp, FREE_DBT(lp, data);
&data, &lsn, TXN_OPENFILES, txninfo)) < 0) { if (ret != 0 && ret != DB_TXN_CKP)
ret = tret;
goto msgerr; 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); for (ret = log_get(lp, &lsn, &data, DB_LAST);
ret == 0 && log_compare(&lsn, &first_lsn) > 0; ret == 0 && log_compare(&lsn, &first_lsn) > 0;
ret = log_get(lp,&lsn, &data, DB_PREV)) { ret = log_get(lp,&lsn, &data, DB_PREV)) {
tmp_lsn = lsn; tmp_lsn = lsn;
tret = ret = __db_dispatch(lp,
__db_dispatch(lp, &data, &lsn, TXN_BACKWARD_ROLL, txninfo); &data, &lsn, TXN_BACKWARD_ROLL, txninfo);
if (IS_ZERO_LSN(ckp_lsn) && tret > 0) FREE_DBT(lp, data);
ckp_lsn = tmp_lsn; if (ret == DB_TXN_CKP) {
if (tret < 0) { if (IS_ZERO_LSN(ckp_lsn))
ret = tret; ckp_lsn = tmp_lsn;
ret = 0;
} else if (ret != 0)
goto msgerr; goto msgerr;
}
} }
FREE_DBT(lp, data);
if (ret != 0 && ret != DB_NOTFOUND)
goto err;
for (ret = log_get(lp, &lsn, &data, DB_NEXT); for (ret = log_get(lp, &lsn, &data, DB_NEXT);
ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT)) ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT)) {
if ((tret = __db_dispatch(lp, ret = __db_dispatch(lp, &data, &lsn, TXN_FORWARD_ROLL, txninfo);
&data, &lsn, TXN_FORWARD_ROLL, txninfo)) < 0) { FREE_DBT(lp, data);
ret = tret; if (ret == DB_TXN_CKP)
ret = 0;
else if (ret != 0)
goto msgerr; goto msgerr;
} }
FREE_DBT(lp, data);
if (ret != DB_NOTFOUND)
goto err;
/* Now close all the db files that are open. */ /* Now close all the db files that are open. */
__log_close_files(lp); __log_close_files(lp);
@ -118,11 +149,11 @@ __db_apprec(dbenv, flags)
* and the current time. Then take a checkpoint. * and the current time. Then take a checkpoint.
*/ */
(void)time(&now); (void)time(&now);
dbenv->tx_info->region->last_txnid = ((__db_txnhead *)txninfo)->maxid; dbenv->tx_info->region->last_txnid = ((__db_txnhead *)txninfo)->maxid;
dbenv->tx_info->region->last_ckp = ckp_lsn; dbenv->tx_info->region->last_ckp = ckp_lsn;
dbenv->tx_info->region->time_ckp = (u_int32_t) now; dbenv->tx_info->region->time_ckp = (u_int32_t)now;
txn_checkpoint(dbenv->tx_info, 0, 0); if ((ret = txn_checkpoint(dbenv->tx_info, 0, 0)) != 0)
goto err;
if (dbenv->db_verbose) { if (dbenv->db_verbose) {
__db_err(lp->dbenv, "Recovery complete at %s", ctime(&now)); __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", msgerr: __db_err(dbenv, "Recovery function for LSN %lu %lu failed",
(u_long)lsn.file, (u_long)lsn.offset); (u_long)lsn.file, (u_long)lsn.offset);
err: return (ret); err: FREE_DBT(lp, data);
return (ret);
} }

View File

@ -17,6 +17,13 @@ static const char sccsid[] = "@(#)db_byteorder.c 10.3 (Sleepycat) 6/21/97";
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef HAVE_ENDIAN_H
# include <endian.h>
# if BYTE_ORDER == BIG_ENDIAN
# define WORDS_BIGENDIAN 1
# endif
#endif
#include "db_int.h" #include "db_int.h"
#include "common_ext.h" #include "common_ext.h"

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -221,7 +221,7 @@ __db_panic(dbp)
* __db_fchk -- * __db_fchk --
* General flags checking routine. * 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 int
__db_fchk(dbenv, name, flags, ok_flags) __db_fchk(dbenv, name, flags, ok_flags)
@ -237,7 +237,7 @@ __db_fchk(dbenv, name, flags, ok_flags)
* __db_fcchk -- * __db_fcchk --
* General combination flags checking routine. * 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 int
__db_fcchk(dbenv, name, flags, flag1, flag2) __db_fcchk(dbenv, name, flags, flag1, flag2)
@ -521,7 +521,7 @@ __db_syncchk(dbp, flags)
* __db_ferr -- * __db_ferr --
* Common flag errors. * 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 int
__db_ferr(dbenv, name, combo) __db_ferr(dbenv, name, combo)

View File

@ -43,7 +43,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -229,7 +229,7 @@ __db_ropen(dbenv, appname, path, file, flags, fdp, retp)
goto err2; goto err2;
/* Check to make sure the first block has been written. */ /* Check to make sure the first block has been written. */
if ((size_t) size1 < sizeof(RLAYOUT)) { if ((size_t)size1 < sizeof(RLAYOUT)) {
ret = EAGAIN; ret = EAGAIN;
goto err2; goto err2;
} }

View File

@ -2,7 +2,6 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated automatically from configure.in by autoheader. */
/* ...but edited by hand to be used in GNU libc. */ /* ...but edited by hand to be used in GNU libc. */
#include <endian.h>
#include <sys/stat.h> /* To get _STATBUF_ST_BLKSIZE. */ #include <sys/stat.h> /* To get _STATBUF_ST_BLKSIZE. */
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
@ -28,11 +27,8 @@
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define if your processor stores words with the most significant /* Say we have endian.h. */
byte first (like Motorola and SPARC, unlike Intel and VAX). */ #define HAVE_ENDIAN_H 1
#if __BYTE_ORDER == BIG_ENDIAN
# define WORDS_BIGENDIAN 1
#endif
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
/* #undef ssize_t */ /* #undef ssize_t */

View File

@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997 * Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved. * 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_ #ifndef _DB_H_
@ -67,8 +67,8 @@
#define DB_VERSION_MAJOR 2 #define DB_VERSION_MAJOR 2
#define DB_VERSION_MINOR 3 #define DB_VERSION_MINOR 3
#define DB_VERSION_PATCH 4 #define DB_VERSION_PATCH 6
#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.4: (8/20/97)" #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_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset 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_NEEDSPLIT ( -9) /* Page needs to be split. */
#define DB_REGISTERED (-10) /* Entry was previously registered. */ #define DB_REGISTERED (-10) /* Entry was previously registered. */
#define DB_SWAPBYTES (-11) /* Database needs byte swapping. */ #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. */ struct __db_ilock { /* Internal DB access method lock. */
db_pgno_t pgno; /* Page being locked. */ 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_appinit __P((const char *, char * const *, DB_ENV *, int));
int db_appexit __P((DB_ENV *)); int db_appexit __P((DB_ENV *));
int db_open __P((const char *, DBTYPE, int, int, DB_ENV *, DB_INFO *, DB **)); 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) #if defined(__cplusplus)
}; };
#endif #endif

View File

@ -44,7 +44,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #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 * that fail, we simply retry without the O_CREAT flag, which
* will require that the meta-data page exist. * 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; retry_cnt = 0;
open_retry: if (LF_ISSET(DB_CREATE)) { open_retry: if (LF_ISSET(DB_CREATE)) {
if ((ret = __db_fdopen(real_name, flags | DB_EXCL, 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 * The only way we can reach here with the DB_CREATE
* flag set is if we created the file. If we didn't * flag set is if we created the file. If that's not
* create the file, there's a chance that someone else * the case, then a) someone else created the file
* is busily doing so. Sleep and give them a chance, * but has not yet written out the meta-data page, or
* because we need the metadata page their going to * b) we truncated the file (DB_TRUNCATE) leaving it
* write. * 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); __db_sleep(1, 0);
goto open_retry; goto open_retry;
} }

View File

@ -44,7 +44,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -145,7 +145,7 @@ __db_convert(pg, pp, pgin)
M_16_SWAP(h->inp[i]); M_16_SWAP(h->inp[i]);
bk = GET_BKEYDATA(h, i); bk = GET_BKEYDATA(h, i);
switch (bk->type) { switch (B_TYPE(bk->type)) {
case B_KEYDATA: case B_KEYDATA:
M_16_SWAP(bk->len); M_16_SWAP(bk->len);
break; break;
@ -167,7 +167,7 @@ __db_convert(pg, pp, pgin)
M_16_SWAP(h->inp[i]); M_16_SWAP(h->inp[i]);
bi = GET_BINTERNAL(h, i); bi = GET_BINTERNAL(h, i);
switch (bi->type) { switch (B_TYPE(bi->type)) {
case B_KEYDATA: case B_KEYDATA:
M_16_SWAP(bi->len); M_16_SWAP(bi->len);
M_32_SWAP(bi->pgno); M_32_SWAP(bi->pgno);

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -65,8 +65,7 @@ __db_dput(dbp, dbt, pp, indxp, newfunc)
if (dbt->size > 0.25 * dbp->pgsize) { if (dbt->size > 0.25 * dbp->pgsize) {
if ((ret = __db_poff(dbp, dbt, &pgno, newfunc)) != 0) if ((ret = __db_poff(dbp, dbt, &pgno, newfunc)) != 0)
return (ret); return (ret);
bo.deleted = 0; B_TSET(bo.type, B_OVERFLOW, 0);
bo.type = B_OVERFLOW;
bo.tlen = dbt->size; bo.tlen = dbt->size;
bo.pgno = pgno; bo.pgno = pgno;
hdr_dbt.data = &bo; hdr_dbt.data = &bo;
@ -125,7 +124,7 @@ __db_drem(dbp, pp, indx, freefunc)
pagep = *pp; pagep = *pp;
/* Check if we are freeing a big item. */ /* 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, if ((ret = __db_doff(dbp,
GET_BOVERFLOW(pagep, indx)->pgno, freefunc)) != 0) GET_BOVERFLOW(pagep, indx)->pgno, freefunc)) != 0)
return (ret); return (ret);
@ -255,7 +254,7 @@ __db_dsplit(dbp, hp, indxp, size, newfunc)
lastsum = sum; lastsum = sum;
did_indx = 1; 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); sum += BKEYDATA_SIZE(GET_BKEYDATA(h, i)->len);
else else
sum += BOVERFLOW_SIZE; 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++) { for (nindex = 0, oindex = i + 1; oindex < NUM_ENT(h); oindex++) {
bk = GET_BKEYDATA(h, oindex); bk = GET_BKEYDATA(h, oindex);
if (bk->type == B_KEYDATA) if (B_TYPE(bk->type) == B_KEYDATA)
s = BKEYDATA_SIZE(bk->len); s = BKEYDATA_SIZE(bk->len);
else else
s = BOVERFLOW_SIZE; s = BOVERFLOW_SIZE;
@ -316,7 +315,7 @@ __db_dsplit(dbp, hp, indxp, size, newfunc)
*/ */
for (nindex = 0, oindex = 0; oindex <= i; oindex++) { for (nindex = 0, oindex = 0; oindex <= i; oindex++) {
bk = GET_BKEYDATA(h, oindex); bk = GET_BKEYDATA(h, oindex);
if (bk->type == B_KEYDATA) if (B_TYPE(bk->type) == B_KEYDATA)
s = BKEYDATA_SIZE(bk->len); s = BKEYDATA_SIZE(bk->len);
else else
s = BOVERFLOW_SIZE; s = BOVERFLOW_SIZE;
@ -474,8 +473,7 @@ __db_pitem(dbp, pagep, indx, nbytes, hdr, data)
return (ret); return (ret);
if (hdr == NULL) { if (hdr == NULL) {
bk.deleted = 0; B_TSET(bk.type, B_KEYDATA, 0);
bk.type = B_KEYDATA;
bk.len = data == NULL ? 0 : data->size; bk.len = data == NULL ? 0 : data->size;
thdr.data = &bk; thdr.data = &bk;

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -461,12 +461,12 @@ __db_prpage(h, all)
case P_LBTREE: case P_LBTREE:
bk = GET_BKEYDATA(h, i); bk = GET_BKEYDATA(h, i);
deleted = i % 2 == 0 && deleted = i % 2 == 0 &&
GET_BKEYDATA(h, i + O_INDX)->deleted; B_DISSET(GET_BKEYDATA(h, i + O_INDX)->type);
break; break;
case P_LRECNO: case P_LRECNO:
case P_DUPLICATE: case P_DUPLICATE:
bk = GET_BKEYDATA(h, i); bk = GET_BKEYDATA(h, i);
deleted = GET_BKEYDATA(h, i)->deleted; deleted = B_DISSET(GET_BKEYDATA(h, i)->type);
break; break;
default: default:
fprintf(fp, fprintf(fp,
@ -525,7 +525,7 @@ __db_prpage(h, all)
case P_IBTREE: case P_IBTREE:
fprintf(fp, "count: %4lu pgno: %4lu ", fprintf(fp, "count: %4lu pgno: %4lu ",
(u_long)bi->nrecs, (u_long)bi->pgno); (u_long)bi->nrecs, (u_long)bi->pgno);
switch (bi->type) { switch (B_TYPE(bi->type)) {
case B_KEYDATA: case B_KEYDATA:
__db_pr(bi->data, bi->len); __db_pr(bi->data, bi->len);
break; break;
@ -535,7 +535,7 @@ __db_prpage(h, all)
break; break;
default: default:
fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n", fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n",
(u_long)bi->type); (u_long)B_TYPE(bi->type));
ret = EINVAL; ret = EINVAL;
break; break;
} }
@ -547,7 +547,7 @@ __db_prpage(h, all)
case P_LBTREE: case P_LBTREE:
case P_LRECNO: case P_LRECNO:
case P_DUPLICATE: case P_DUPLICATE:
switch (bk->type) { switch (B_TYPE(bk->type)) {
case B_KEYDATA: case B_KEYDATA:
__db_pr(bk->data, bk->len); __db_pr(bk->data, bk->len);
break; break;
@ -558,7 +558,7 @@ __db_prpage(h, all)
default: default:
fprintf(fp, fprintf(fp,
"ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n", "ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n",
(u_long)bk->type); (u_long)B_TYPE(bk->type));
ret = EINVAL; ret = EINVAL;
break; break;
} }
@ -630,11 +630,11 @@ __db_isbad(h, die)
break; break;
case P_IBTREE: case P_IBTREE:
bi = GET_BINTERNAL(h, i); bi = GET_BINTERNAL(h, i);
if (bi->type != B_KEYDATA && if (B_TYPE(bi->type) != B_KEYDATA &&
bi->type != B_DUPLICATE && B_TYPE(bi->type) != B_DUPLICATE &&
bi->type != B_OVERFLOW) { B_TYPE(bi->type) != B_OVERFLOW) {
fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n", fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n",
(u_long)bi->type); (u_long)B_TYPE(bi->type));
goto bad; goto bad;
} }
break; break;
@ -644,12 +644,12 @@ __db_isbad(h, die)
break; break;
case P_DUPLICATE: case P_DUPLICATE:
bk = GET_BKEYDATA(h, i); bk = GET_BKEYDATA(h, i);
if (bk->type != B_KEYDATA && if (B_TYPE(bk->type) != B_KEYDATA &&
bk->type != B_DUPLICATE && B_TYPE(bk->type) != B_DUPLICATE &&
bk->type != B_OVERFLOW) { B_TYPE(bk->type) != B_OVERFLOW) {
fprintf(fp, fprintf(fp,
"ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n", "ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n",
(u_long)bk->type); (u_long)B_TYPE(bk->type));
goto bad; goto bad;
} }
break; break;
@ -713,18 +713,18 @@ __db_proff(vp)
void *vp; void *vp;
{ {
FILE *fp; FILE *fp;
BOVERFLOW *p; BOVERFLOW *bo;
fp = __db_prinit(NULL); fp = __db_prinit(NULL);
p = vp; bo = vp;
switch (p->type) { switch (B_TYPE(bo->type)) {
case B_OVERFLOW: case B_OVERFLOW:
fprintf(fp, "overflow: total len: %4lu page: %4lu\n", 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; break;
case B_DUPLICATE: case B_DUPLICATE:
fprintf(fp, "duplicate: page: %4lu\n", (u_long)p->pgno); fprintf(fp, "duplicate: page: %4lu\n", (u_long)bo->pgno);
break; break;
} }
} }

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -63,7 +63,7 @@ __db_ret(dbp, h, indx, dbt, memp, memsize)
case P_LBTREE: case P_LBTREE:
case P_LRECNO: case P_LRECNO:
bk = GET_BKEYDATA(h, indx); bk = GET_BKEYDATA(h, indx);
if (bk->type == B_OVERFLOW) { if (B_TYPE(bk->type) == B_OVERFLOW) {
bo = (BOVERFLOW *)bk; bo = (BOVERFLOW *)bk;
return (__db_goff(dbp, dbt, return (__db_goff(dbp, dbt,
bo->tlen, bo->pgno, memp, memsize)); bo->tlen, bo->pgno, memp, memsize));

View File

@ -38,7 +38,7 @@ static int db185_seq __P((const DB185 *, DBT185 *, DBT185 *, u_int));
static int db185_sync __P((const DB185 *, u_int)); static int db185_sync __P((const DB185 *, u_int));
DB185 * DB185 *
__dbopen(file, oflags, mode, type, openinfo) dbopen(file, oflags, mode, type, openinfo)
const char *file; const char *file;
int oflags, mode; int oflags, mode;
DBTYPE type; DBTYPE type;
@ -203,7 +203,6 @@ einval: free(db185p);
errno = EINVAL; errno = EINVAL;
return (NULL); return (NULL);
} }
weak_alias (__dbopen, dbopen)
static int static int
db185_close(db185p) db185_close(db185p)

View File

@ -47,7 +47,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #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 "db_page.h"
#include "hash.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. * 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)); 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 int
dbminit(file) dbminit(file)
char *file; char *file;

View File

@ -42,7 +42,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
/* /*
@ -277,8 +277,7 @@ __ham_dup_convert(hashp, hcp)
dndx = 0; dndx = 0;
memcpy(&ho, memcpy(&ho,
P_ENTRY(hcp->pagep, H_DATAINDEX(hcp->bndx)), HOFFPAGE_SIZE); P_ENTRY(hcp->pagep, H_DATAINDEX(hcp->bndx)), HOFFPAGE_SIZE);
bo.deleted = 0; B_TSET(bo.type, ho.type, 0);
bo.type = ho.type;
bo.pgno = ho.pgno; bo.pgno = ho.pgno;
bo.tlen = ho.tlen; bo.tlen = ho.tlen;
dbt.size = BOVERFLOW_SIZE; dbt.size = BOVERFLOW_SIZE;

View File

@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997 * Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved. * 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 #ifndef _DB_AM_H
#define _DB_AM_H #define _DB_AM_H
@ -30,7 +30,7 @@
file_dbp = mdbp = NULL; \ file_dbp = mdbp = NULL; \
if ((ret = func(dbtp->data, &argp)) != 0) \ if ((ret = func(dbtp->data, &argp)) != 0) \
goto out; \ 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) \ if (ret == DB_DELETED) \
ret = 0; \ ret = 0; \
goto out; \ goto out; \

View File

@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997 * Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved. * 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_ #ifndef _DB_PAGE_H_
@ -399,6 +399,24 @@ typedef struct _hoffdup {
#define B_DUPLICATE 2 /* Duplicate key/data item. */ #define B_DUPLICATE 2 /* Duplicate key/data item. */
#define B_OVERFLOW 3 /* Overflow key/data item. */ #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: * The first type is B_KEYDATA, represented by the BKEYDATA structure:
* *
@ -408,8 +426,7 @@ typedef struct _hoffdup {
*/ */
typedef struct _bkeydata { typedef struct _bkeydata {
db_indx_t len; /* 00-01: Key/data item length. */ db_indx_t len; /* 00-01: Key/data item length. */
u_int deleted :1; /* 02: Page type and delete flag. */ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int type :7;
u_int8_t data[1]; /* Variable length key/data item. */ u_int8_t data[1]; /* Variable length key/data item. */
} BKEYDATA; } BKEYDATA;
@ -438,8 +455,7 @@ typedef struct _bkeydata {
*/ */
typedef struct _boverflow { typedef struct _boverflow {
db_indx_t unused1; /* 00-01: Padding, unused. */ db_indx_t unused1; /* 00-01: Padding, unused. */
u_int deleted :1; /* 02: Page type and delete flag. */ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int type :7;
u_int8_t unused2; /* 03: Padding, unused. */ u_int8_t unused2; /* 03: Padding, unused. */
db_pgno_t pgno; /* 04-07: Next page number. */ db_pgno_t pgno; /* 04-07: Next page number. */
u_int32_t tlen; /* 08-11: Total length of item. */ u_int32_t tlen; /* 08-11: Total length of item. */
@ -479,9 +495,8 @@ typedef struct _boverflow {
* +-----------------------------------+ * +-----------------------------------+
*/ */
typedef struct _binternal { typedef struct _binternal {
db_indx_t len; /* 00-01: Key/data item length. */ db_indx_t len; /* 00-01: Key/data item length. */
u_int deleted :1; /* 02: Page type and delete flag. */ u_int8_t type; /* 02: Page type AND DELETE FLAG. */
u_int type :7;
u_int8_t unused; /* 03: Padding, unused. */ u_int8_t unused; /* 03: Padding, unused. */
db_pgno_t pgno; /* 04-07: Page number of referenced page. */ db_pgno_t pgno; /* 04-07: Page number of referenced page. */
db_recno_t nrecs; /* 08-11: Subtree record count. */ db_recno_t nrecs; /* 08-11: Subtree record count. */

View File

@ -4,7 +4,7 @@
* Copyright (c) 1996, 1997 * Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved. * 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; struct __bh; typedef struct __bh BH;
@ -161,9 +161,12 @@ struct __db_mpoolfile {
void *addr; /* Address of mmap'd region. */ void *addr; /* Address of mmap'd region. */
size_t len; /* Length of mmap'd region. */ size_t len; /* Length of mmap'd region. */
#define MP_PATH_ALLOC 0x01 /* Path is allocated memory. */ /* These fields need to be protected for multi-threaded support. */
#define MP_PATH_TEMP 0x02 /* Backing file is a temporary. */ #define MP_PATH_ALLOC 0x001 /* Path is allocated memory. */
#define MP_READONLY 0x04 /* File is readonly. */ #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; u_int32_t flags;
}; };

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -115,8 +115,8 @@ __log_get(dblp, alsn, dbt, flags, silent)
size_t len; size_t len;
ssize_t nr; ssize_t nr;
int cnt, ret; int cnt, ret;
const char *fail;
char *np, *tbuf; char *np, *tbuf;
const char *fail;
void *p, *shortp; void *p, *shortp;
lp = dblp->lp; lp = dblp->lp;

View File

@ -40,7 +40,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -132,10 +132,16 @@ __log_unregister_recover(logp, dbtp, lsnp, redo, info)
if ((ret = __log_unregister_read(dbtp->data, &argp)) != 0) if ((ret = __log_unregister_read(dbtp->data, &argp)) != 0)
goto out; 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); LOCK_LOGTHREAD(logp);
if (logp->dbentry[argp->id].dbp == NULL) if (logp->dbentry[argp->id].dbp == NULL) {
ret = EINVAL; if (!logp->dbentry[argp->id].deleted)
else if (--logp->dbentry[argp->id].refcount == 0) { ret = EINVAL;
} else if (--logp->dbentry[argp->id].refcount == 0) {
ret = logp->dbentry[argp->id].dbp->close( ret = logp->dbentry[argp->id].dbp->close(
logp->dbentry[argp->id].dbp, 0); logp->dbentry[argp->id].dbp, 0);
logp->dbentry[argp->id].dbp = NULL; logp->dbentry[argp->id].dbp = NULL;

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #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 "mp.h"
#include "common_ext.h" #include "common_ext.h"
static int __memp_upgrade __P((DB_MPOOL *, DB_MPOOLFILE *, MPOOLFILE *));
/* /*
* __memp_bhwrite -- * __memp_bhwrite --
* Write the page associated with a given bucket header. * Write the page associated with a given bucket header.
@ -48,14 +50,20 @@ __memp_bhwrite(dbmp, mfp, bhp, restartp, wrotep)
*wrotep = 0; *wrotep = 0;
/* /*
* Walk the process' DB_MPOOLFILE list and try and find a file * Walk the process' DB_MPOOLFILE list and find a file descriptor for
* descriptor for this file. * 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); LOCKHANDLE(dbmp, &dbmp->mutex);
for (dbmfp = TAILQ_FIRST(&dbmp->dbmfq); for (dbmfp = TAILQ_FIRST(&dbmp->dbmfq);
dbmfp != NULL; dbmfp = TAILQ_NEXT(dbmfp, q)) 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; break;
}
UNLOCKHANDLE(dbmp, &dbmp->mutex); UNLOCKHANDLE(dbmp, &dbmp->mutex);
if (dbmfp != NULL) if (dbmfp != NULL)
goto found; 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 * Try and open the file; ignore any error, assume it's a permissions
* problem. * 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.size = mfp->pgcookie_len;
dbt.data = ADDR(dbmp, mfp->pgcookie_off); dbt.data = ADDR(dbmp, mfp->pgcookie_off);
@ -435,3 +447,42 @@ __memp_bhfree(dbmp, mfp, bhp, free_mem)
if (free_mem) if (free_mem)
__db_shalloc_free(dbmp->addr, bhp); __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);
}

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -110,7 +110,7 @@ __memp_fopen(dbmp, path,
ret = EINVAL; ret = EINVAL;
goto err; goto err;
} }
dbmfp->path = (char *) TEMPORARY; dbmfp->path = (char *)TEMPORARY;
F_SET(dbmfp, MP_PATH_TEMP); F_SET(dbmfp, MP_PATH_TEMP);
} else { } else {
/* Calculate the real name for this file. */ /* Calculate the real name for this file. */

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -167,8 +167,12 @@ memp_fsync(dbmfp)
size_t mf_offset; size_t mf_offset;
int pincnt, restart, ret, wrote; 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); return (0);
dbmp = dbmfp->dbmp; dbmp = dbmfp->dbmp;
@ -199,7 +203,7 @@ retry: pincnt = 0;
goto retry; goto retry;
} }
UNLOCKREGION(dbmp); err: UNLOCKREGION(dbmp);
err: return (ret == 0 ? (pincnt ? DB_INCOMPLETE : 0) : ret); return (ret == 0 ? (pincnt ? DB_INCOMPLETE : 0) : ret);
} }

View File

@ -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. * For gcc/x86, 0 is clear, 1 is set.
*/ */
#define TSL_SET(tsl) ({ \ #define TSL_SET(tsl) ({ \
register tsl_t *__l = (tsl); \ register tsl_t *__l = (tsl); \
int __r; \ 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) \ : "=&a" (__r), "=m" (*__l) \
: "1" (*__l) \ : "1" (*__l) \
); \ ); \

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -45,7 +45,7 @@ static const char sccsid[] = "@(#)db_os_dir.c 10.7 (Sleepycat) 8/23/97";
* __db_dir -- * __db_dir --
* Return a list of the files in a directory. * 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 int
__db_dir(dbenv, dir, namesp, cntp) __db_dir(dbenv, dir, namesp, cntp)
@ -61,7 +61,7 @@ __db_dir(dbenv, dir, namesp, cntp)
long dirhandle; long dirhandle;
int finished; int finished;
if ((dirhandle = _findfirst(dir,&fdata)) == -1) { if ((dirhandle = _findfirst(dir, &fdata)) == -1) {
__db_err(dbenv, "%s: %s", dir, strerror(errno)); __db_err(dbenv, "%s: %s", dir, strerror(errno));
return (errno); return (errno);
} }

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -39,9 +39,9 @@ __db_fileid(dbenv, fname, timestamp, fidp)
int timestamp; int timestamp;
u_int8_t *fidp; u_int8_t *fidp;
{ {
size_t i;
time_t now; time_t now;
u_int8_t *p; u_int8_t *p;
unsigned int i;
#ifdef _WIN32 #ifdef _WIN32
/* /*

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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)); DB_ENV *db_init __P((char *, int));
void onint __P((int)); void onint __P((int));
int main __P((int, char *[]));
void siginit __P((void)); void siginit __P((void));
void usage __P((void)); void usage __P((void));
int main __P((int, char *[]));
int interrupted; int interrupted;
const char *progname = "db_archive"; /* Program name. */ const char
*progname = "db_archive"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -39,14 +39,15 @@ char *check __P((DB_ENV *, long, long));
int checkpoint __P((DB_ENV *, char *, int)); int checkpoint __P((DB_ENV *, char *, int));
DB_ENV *db_init __P((char *)); DB_ENV *db_init __P((char *));
int logpid __P((char *, int)); int logpid __P((char *, int));
int main __P((int, char *[]));
void onint __P((int)); void onint __P((int));
void siginit __P((void)); void siginit __P((void));
void usage __P((void)); void usage __P((void));
int main __P((int, char *[]));
int interrupted; int interrupted;
time_t now; /* Checkpoint time. */ time_t now; /* Checkpoint time. */
const char *progname = "db_checkpoint"; /* Program name. */ const char
*progname = "db_checkpoint"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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 #define BAD_KILLID 0xffffffff
DB_ENV *db_init __P((char *, int)); DB_ENV *db_init __P((char *, int));
int logpid __P((char *, int));
int main __P((int, char *[]));
void onint __P((int)); void onint __P((int));
void siginit __P((void)); void siginit __P((void));
void usage __P((void)); void usage __P((void));
int logpid __P((char *, int));
int main __P((int, char *[]));
int interrupted; int interrupted;
const char *progname = "db_deadlock"; /* Program name. */ const char
*progname = "db_deadlock"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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 <ctype.h>
#include <errno.h> #include <errno.h>
#include <getopt.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#endif #endif
#include "db_int.h" #include "db_int.h"
@ -35,11 +35,12 @@ void configure __P((char *));
DB_ENV *db_init __P((char *)); DB_ENV *db_init __P((char *));
void dbt_dump __P((DBT *)); void dbt_dump __P((DBT *));
void dbt_print __P((DBT *)); void dbt_print __P((DBT *));
int main __P((int, char *[]));
void pheader __P((DB *, int)); void pheader __P((DB *, int));
void usage __P((void)); void usage __P((void));
int main __P((int, char *[]));
const char *progname = "db_dump"; /* Program name. */ const char
*progname = "db_dump"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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 <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <getopt.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#endif #endif
#include "db_185.h" #include "db_185.h"
@ -149,14 +149,15 @@ typedef struct _btree {
u_int32_t flags; u_int32_t flags;
} BTREE; } BTREE;
void db_185_btree __P((DB *, int)); void db_185_btree __P((DB *, int));
void db_185_hash __P((DB *, int)); void db_185_hash __P((DB *, int));
void dbt_dump __P((DBT *)); void dbt_dump __P((DBT *));
void dbt_print __P((DBT *)); void dbt_print __P((DBT *));
void usage __P((void)); int main __P((int, char *[]));
int main __P((int, char *[])); void usage __P((void));
const char *progname = "db_dump185"; /* Program name. */ const char
*progname = "db_dump185"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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 <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <getopt.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#endif #endif
#include "db_int.h" #include "db_int.h"
@ -35,11 +35,12 @@ DB_ENV *db_init __P((char *));
int dbt_rdump __P((DBT *)); int dbt_rdump __P((DBT *));
int dbt_rprint __P((DBT *)); int dbt_rprint __P((DBT *));
int digitize __P((int)); int digitize __P((int));
int main __P((int, char *[]));
void rheader __P((DBTYPE *, int *, DB_INFO *)); void rheader __P((DBTYPE *, int *, DB_INFO *));
void usage __P((void)); void usage __P((void));
int main __P((int, char *[]));
const char *progname = "db_load"; /* Program name. */ const char
*progname = "db_load"; /* Program name. */
int int
main(argc, argv) main(argc, argv)
@ -273,7 +274,7 @@ rheader(dbtypep, pflagp, dbinfop)
for (lineno = 1;; ++lineno) { for (lineno = 1;; ++lineno) {
if (fscanf(stdin, "%[^=]=%s\n", name, value) != 2) 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) if (strcmp(name, "HEADER") == 0)
break; break;

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #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" #include "clib_ext.h"
DB_ENV *db_init __P((char *)); DB_ENV *db_init __P((char *));
int main __P((int, char *[]));
void onint __P((int)); void onint __P((int));
void usage __P((void)); void usage __P((void));
int interrupted; int interrupted;
char *progname = "db_printlog"; /* Program name. */ const char
*progname = "db_printlog"; /* Program name. */
int int
main(argc, argv) main(argc, argv)
@ -114,7 +116,7 @@ main(argc, argv)
(void)raise(SIGINT); (void)raise(SIGINT);
/* NOTREACHED */ /* NOTREACHED */
} }
exit (eval); return (eval);
} }
/* /*

View File

@ -11,16 +11,16 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <getopt.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#endif #endif
#include "db_int.h" #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" #include "clib_ext.h"
DB_ENV *db_init __P((char *, int, int)); DB_ENV *db_init __P((char *, int, int));
void usage __P((void));
int main __P((int, char *[])); int main __P((int, char *[]));
void usage __P((void));
const char *progname = "db_recover"; /* Program name. */ const char
*progname = "db_recover"; /* Program name. */
int int
main(argc, argv) main(argc, argv)

View File

@ -11,7 +11,7 @@
static const char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1997\n\ "@(#) Copyright (c) 1997\n\
Sleepycat Software Inc. All rights reserved.\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 #endif
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -36,16 +36,17 @@ typedef enum { T_NOTSET, T_DB, T_MPOOL, T_TXN } test_t;
void bstat __P((DB *)); void bstat __P((DB *));
DB_ENV *db_init __P((char *, test_t)); DB_ENV *db_init __P((char *, test_t));
void hstat __P((DB *)); void hstat __P((DB *));
int main __P((int, char *[]));
void mstat __P((DB_ENV *)); void mstat __P((DB_ENV *));
void prflags __P((u_int32_t, const FN *));
void onint __P((int)); void onint __P((int));
void prflags __P((u_int32_t, const FN *));
void tstat __P((DB_ENV *)); void tstat __P((DB_ENV *));
int txn_compare __P((const void *, const void *)); int txn_compare __P((const void *, const void *));
void usage __P((void)); void usage __P((void));
int main __P((int, char *[]));
int interrupted; int interrupted;
const char *progname = "db_stat"; /* Program name. */ const char
*progname = "db_stat"; /* Program name. */
int int
main(argc, argv) main(argc, argv)
@ -297,7 +298,7 @@ tstat(dbenv)
DB_ENV *dbenv; DB_ENV *dbenv;
{ {
DB_TXN_STAT *tstat; DB_TXN_STAT *tstat;
unsigned int i; u_int32_t i;
const char *p; const char *p;
if (txn_stat(dbenv->tx_info, &tstat, NULL)) if (txn_stat(dbenv->tx_info, &tstat, NULL))

View File

@ -43,7 +43,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
@ -80,12 +80,11 @@ static const char sccsid[] = "@(#)txn.c 10.20 (Sleepycat) 8/24/97";
#include "common_ext.h" #include "common_ext.h"
static int __txn_check_running __P((const DB_TXN *)); static int __txn_check_running __P((const DB_TXN *));
static int __txn_create __P((DB_ENV *, const char *, u_int));
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_grow_region __P((DB_TXNMGR *));
static int __txn_validate_region __P((DB_TXNMGR *)); static int __txn_undo __P((DB_TXN *));
static int __txn_end __P((DB_TXN *, int)); static int __txn_validate_region __P((DB_TXNMGR *));
static int __txn_undo __P((DB_TXN *));
/* /*
* Create and initialize a transaction region in shared memory. * Create and initialize a transaction region in shared memory.
@ -622,6 +621,7 @@ txn_checkpoint(mgr, kbytes, minutes)
if (minutes != 0 || kbytes != 0) if (minutes != 0 || kbytes != 0)
return (0); return (0);
do_ckp:
if (IS_ZERO_LSN(ckp_lsn)) { if (IS_ZERO_LSN(ckp_lsn)) {
dblp = mgr->dbenv->lg_info; dblp = mgr->dbenv->lg_info;
LOCK_LOGREGION(dblp); LOCK_LOGREGION(dblp);
@ -633,7 +633,6 @@ txn_checkpoint(mgr, kbytes, minutes)
* We have to find an LSN such that all transactions begun * We have to find an LSN such that all transactions begun
* before that LSN are complete. * before that LSN are complete.
*/ */
do_ckp:
LOCK_TXNREGION(mgr); LOCK_TXNREGION(mgr);
if (!IS_ZERO_LSN(mgr->region->pending_ckp)) if (!IS_ZERO_LSN(mgr->region->pending_ckp))
@ -755,8 +754,7 @@ txn_stat(mgr, statp, db_malloc)
{ {
DB_TXN_STAT *stats; DB_TXN_STAT *stats;
size_t nbytes; size_t nbytes;
u_int32_t nactive; u_int32_t i, nactive, ndx;
unsigned int i, ndx;
LOCK_TXNREGION(mgr); LOCK_TXNREGION(mgr);
nactive = mgr->region->nbegins - nactive = mgr->region->nbegins -

View File

@ -40,7 +40,7 @@
#include "config.h" #include "config.h"
#ifndef lint #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 */ #endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES #ifndef NO_SYSTEM_INCLUDES
@ -127,5 +127,5 @@ __txn_ckp_recover(logp, dbtp, lsnp, redo, info)
*lsnp = argp->last_ckp; *lsnp = argp->last_ckp;
free(argp); free(argp);
return (1); return (DB_TXN_CKP);
} }

View File

@ -1,5 +1,5 @@
/* _dl_close -- Close a shared object opened by `_dl_open'. /* Close a shared object opened by `_dl_open'.
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -23,8 +23,14 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mman.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) #define LOSE(s) _dl_signal_error (0, map->l_name, s)
void void
@ -36,10 +42,16 @@ _dl_close (struct link_map *map)
if (map->l_opencount == 0) if (map->l_opencount == 0)
LOSE ("shared object not open"); LOSE ("shared object not open");
/* Acquire the lock. */
__libc_lock_lock (_dl_load_lock);
/* Decrement the reference count. */ /* Decrement the reference count. */
if (--map->l_opencount > 0 || map->l_type != lt_loaded) 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. */ /* Notify the debugger we are about to remove some loaded objects. */
_r_debug.r_state = RT_DELETE; _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. */ /* Notify the debugger those objects are finalized and gone. */
_r_debug.r_state = RT_CONSISTENT; _r_debug.r_state = RT_CONSISTENT;
_dl_debug_state (); _dl_debug_state ();
/* Release the lock. */
__libc_lock_unlock (_dl_load_lock);
} }

View File

@ -84,7 +84,7 @@ _dl_map_object_deps (struct link_map *map,
int trace_mode) int trace_mode)
{ {
struct list known[1 + npreloads + 1]; struct list known[1 + npreloads + 1];
struct list *runp, *head, *utail, *dtail; struct list *runp, *utail, *dtail;
unsigned int nlist, nduplist, i; unsigned int nlist, nduplist, i;
inline void preload (struct link_map *map) 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].unique = NULL;
known[nlist - 1].dup = NULL; known[nlist - 1].dup = NULL;
/* Pointer to the first member of the unique and duplicate list. */
head = known;
/* Pointer to last unique object. */ /* Pointer to last unique object. */
utail = &known[nlist - 1]; utail = &known[nlist - 1];
/* Pointer to last loaded object. */ /* Pointer to last loaded object. */
@ -300,7 +297,7 @@ _dl_map_object_deps (struct link_map *map,
situation is really not that frequent. So situation is really not that frequent. So
we don't use a double-linked list but we don't use a double-linked list but
instead search for the preceding element. */ instead search for the preceding element. */
late = head; late = known;
while (late->unique != orig) while (late->unique != orig)
late = late->unique; late = late->unique;
late->unique = newp; late->unique = newp;
@ -361,7 +358,7 @@ _dl_map_object_deps (struct link_map *map,
"cannot allocate symbol search list"); "cannot allocate symbol search list");
map->l_nsearchlist = nlist; 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; 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, _dl_signal_error (ENOMEM, map->l_name,
"cannot allocate symbol search list"); "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; map->l_dupsearchlist[nlist++] = runp->map;
} }
} }

View File

@ -21,6 +21,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <libc-lock.h>
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
@ -38,6 +39,17 @@ extern char **__environ;
size_t _dl_global_scope_alloc; 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 * struct link_map *
_dl_open (const char *file, int mode) _dl_open (const char *file, int mode)
{ {
@ -45,11 +57,17 @@ _dl_open (const char *file, int mode)
ElfW(Addr) init; ElfW(Addr) init;
struct r_debug *r; struct r_debug *r;
/* Make sure we are alone. */
__libc_lock_lock (_dl_load_lock);
/* Load the named object. */ /* Load the named object. */
new = _dl_map_object (NULL, file, lt_loaded, 0); new = _dl_map_object (NULL, file, lt_loaded, 0);
if (new->l_searchlist) 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. */ /* Load that object's dependencies. */
_dl_map_object_deps (new, NULL, 0, 0); _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. */ has loaded a dynamic object now has competition. */
__libc_multiple_libcs = 1; __libc_multiple_libcs = 1;
/* Release the lock. */
__libc_lock_unlock (_dl_load_lock);
return new; return new;
} }

View File

@ -46,7 +46,7 @@ extern char **_dl_argv;
\ \
cp = result = alloca (len); \ cp = result = alloca (len); \
for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
cp = stpcpy (cp, all[cnt]); \ cp = __stpcpy (cp, all[cnt]); \
\ \
result; \ result; \
}) })
@ -55,11 +55,12 @@ extern char **_dl_argv;
static inline struct link_map * static inline struct link_map *
find_needed (const char *name, struct link_map *map) find_needed (const char *name, struct link_map *map)
{ {
struct link_map *tmap;
unsigned int n; unsigned int n;
for (n = 0; n < _dl_loaded->l_nsearchlist; ++n) for (tmap = _dl_loaded; tmap != NULL; tmap = tmap->l_next)
if (_dl_name_match_p (name, _dl_loaded->l_searchlist[n])) if (_dl_name_match_p (name, tmap))
return _dl_loaded->l_searchlist[n]; return tmap;
/* The required object is not in the global scope, look to see if it is /* The required object is not in the global scope, look to see if it is
a dependency of the current object. */ a dependency of the current object. */

View File

@ -1,5 +1,5 @@
/* dlclose -- Close a handle opened by `dlopen'. /* Close a handle opened by `dlopen'.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View File

@ -49,3 +49,10 @@ DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
_IO_NO_READS+_IO_UNBUFFERED); _IO_NO_READS+_IO_UNBUFFERED);
_IO_FILE *_IO_list_all = &_IO_stderr_.file; _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

View File

@ -76,12 +76,13 @@ Use this option if your computer lacks hardware floating-point support.
@item --prefix=@var{directory} @item --prefix=@var{directory}
Install machine-independent data files in subdirectories of Install machine-independent data files in subdirectories of
@file{@var{directory}}. (You can also set this in @file{configparms}; @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} @item --exec-prefix=@var{directory}
Install the library and other machine-dependent files in subdirectories Install the library and other machine-dependent files in subdirectories
of @file{@var{directory}}. (You can also set this in 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 @item --enable-shared
@itemx --disable-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. subdirectories (and subdirectory trees) for various Unix variants.
The functions which are system calls in most Unix systems are The functions which are system calls in most Unix systems are
implemented in assembly code in files in @file{sysdeps/unix}. These implemented in assembly code, which is generated automatically from
files are named with a suffix of @samp{.S}; for example, specifications in the file @file{sysdeps/unix/syscalls.list}. Some
@file{__open.S}. Files ending in @samp{.S} are run through the C special system calls are implemented in files that are named with a
preprocessor before being fed to the assembler. 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 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} @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 The memory allocation functions @code{malloc}, @code{realloc} and
@code{free} and related code were written by Michael J. Haertel. @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 @item
Fast implementations of many of the string functions (@code{memcpy}, 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 @item
The @file{tar.h} header file was written by David J. MacKenzie. 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}, and the floating-point reading function used by @code{scanf},
@code{strtod} and friends were written by Ulrich Drepper. The @code{strtod} and friends were written by Ulrich Drepper. The
multi-precision integer functions used in those functions are taken from 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 @item
The internationalization support in the library, and the support The internationalization support in the library, and the support

View File

@ -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 macros above might be rather slow. So it is best to use the builtin
operators unless it is necessary to use unordered comparisons. 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 @node Trig Functions
@section Trigonometric Functions @section Trigonometric Functions

View File

@ -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 @var{domainname} argument is different the previously boundd domains
will not be overwritten. 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} If the @var{dirname} parameter is the null pointer @code{bindtextdomain}
returns the currently selected directory for the domain with the name returns the currently selected directory for the domain with the name
@var{domainname}. @var{domainname}.

View File

@ -357,7 +357,7 @@ Its behaviour is undefined if the strings overlap.
@comment string.h @comment string.h
@comment GNU @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 This function is similar to @code{strdup} but allocates the new string
using @code{alloca} instead of @code{malloc} using @code{alloca} instead of @code{malloc}
@pxref{Variable Size Automatic}. This means of course the returned @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. invalid.
This function is only available if GNU CC is used. This function is only available if GNU CC is used.
@end deftypefun @end deftypefn
@comment string.h @comment string.h
@comment GNU @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 This function is similar to @code{strndup} but like @code{strdupa} it
allocates the new string using @code{alloca} allocates the new string using @code{alloca}
@pxref{Variable Size Automatic}. The same advantages and limitations @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. get the address of it.
@code{strndupa} is only available if GNU CC is used. @code{strndupa} is only available if GNU CC is used.
@end deftypefun @end deftypefn
@comment string.h @comment string.h
@comment ISO @comment ISO

View File

@ -36,8 +36,10 @@ routines = nsswitch $(addsuffix -lookup,$(databases))
databases = proto service hosts network grp pwd rpc ethers \ databases = proto service hosts network grp pwd rpc ethers \
spwd netgrp key alias spwd netgrp key alias
include ../Makeconfig
# Specify rules for the nss_* modules. We have some services. # Specify rules for the nss_* modules. We have some services.
services := files db services := files db $(LDAP)
extra-libs = $(services:%=libnss_%) extra-libs = $(services:%=libnss_%)
# These libraries will be built in the `others' pass rather than # 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))) $(addsuffix .c,$(libnss_db-routines)))
distribute += db-XXX.c distribute += db-XXX.c
libnss_ldap-routines := $(addprefix ldap-,proto) util ldap-nss
libnss_ldap-map := libnss_ldap.map
ifneq ($(build-static-nss),yes) ifneq ($(build-static-nss),yes)
libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
libnss_db-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 endif
# If we compile the LDAP module we need the headers from the LDAP library.
ifneq ($(LDAP),)
CPPFLAGS += -I../ldap
endif
include ../Rules 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 $(libnss_db-routines:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
@rm -f $@.new @rm -f $@.new
@ -79,6 +89,9 @@ $(libnss_db-routines:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
echo '#include <$<>') > $@.new echo '#include <$<>') > $@.new
mv -f $@.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. # 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 # This ensures they will load libc.so for needed symbols if loaded by
# a statically-linked program that hasn't already loaded it. # a statically-linked program that hasn't already loaded it.

View File

@ -62,12 +62,14 @@ alpha-.*-linux.* libnss_db=1.1
alpha-.*-linux.* libnss_compat=1.1 alpha-.*-linux.* libnss_compat=1.1
alpha-.*-linux.* libnss_nis=1.1 alpha-.*-linux.* libnss_nis=1.1
alpha-.*-linux.* libnss_nisplus=1.1 alpha-.*-linux.* libnss_nisplus=1.1
alpha-.*-linux.* libnss_ldap=1.1
.*-.*-.* libnss_files=1 .*-.*-.* libnss_files=1
.*-.*-.* libnss_dns=1 .*-.*-.* libnss_dns=1
.*-.*-.* libnss_db=1 .*-.*-.* libnss_db=1
.*-.*-.* libnss_compat=1 .*-.*-.* libnss_compat=1
.*-.*-.* libnss_nis=1 .*-.*-.* libnss_nis=1
.*-.*-.* libnss_nisplus=1 .*-.*-.* libnss_nisplus=1
.*-.*-.* libnss_ldap=1
# Version for libnsl with YP and NIS+ functions. # Version for libnsl with YP and NIS+ functions.
alpha-.*-linux.* libnsl=1.1 alpha-.*-linux.* libnsl=1.1

View File

@ -107,6 +107,7 @@ CFLAGS-xrusers.c = -Wno-unused
CFLAGS-xspray.c = -Wno-unused CFLAGS-xspray.c = -Wno-unused
CFLAGS-xnfs_prot.c = -Wno-unused CFLAGS-xnfs_prot.c = -Wno-unused
CFLAGS-xrquota.c = -Wno-unused CFLAGS-xrquota.c = -Wno-unused
CFLAGS-xkey_prot.c = -Wno-unused
include ../Rules include ../Rules

View File

@ -175,7 +175,7 @@ print_prog_header(const proc_list *plist)
static void static void
print_trailer(void) print_trailer(void)
{ {
f_print(fout, "\treturn (TRUE);\n"); f_print(fout, "\treturn TRUE;\n");
f_print(fout, "}\n"); f_print(fout, "}\n");
} }
@ -213,7 +213,7 @@ print_ifclose(int indent)
{ {
f_print(fout, ")) {\n"); f_print(fout, ")) {\n");
tabify(fout, indent); tabify(fout, indent);
f_print(fout, "\t return (FALSE);\n"); f_print(fout, "\t return FALSE;\n");
tabify(fout, indent); tabify(fout, indent);
f_print(fout, " }\n"); f_print(fout, " }\n");
} }
@ -377,7 +377,7 @@ emit_union(const definition *def)
#endif #endif
} else { } else {
f_print(fout, "\tdefault:\n"); f_print(fout, "\tdefault:\n");
f_print(fout, "\t\treturn (FALSE);\n"); f_print(fout, "\t\treturn FALSE;\n");
} }
f_print(fout, "\t}\n"); f_print(fout, "\t}\n");
@ -444,7 +444,7 @@ emit_struct(definition *def)
if(flag == PUT) if(flag == PUT)
f_print(fout,"\n\t if (xdrs->x_op == XDR_ENCODE) {\n"); f_print(fout,"\n\t if (xdrs->x_op == XDR_ENCODE) {\n");
else 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; i=0;
@ -583,7 +583,7 @@ emit_struct(definition *def)
} }
flag=GET; 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 */ /* now take care of XDR_FREE case */

256
sysdeps/alpha/fpu/e_sqrt.c Normal file
View File

@ -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 */

View File

@ -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 */

View File

@ -16,6 +16,10 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
#ifndef weak_alias #ifndef weak_alias

View File

@ -30,10 +30,12 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
#endif #endif
{ {
double y; double y;
#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_) if (_LIB_VERSION == _SVID_)
y = __ieee754_lgamma_r(x,&signgam); y = __ieee754_lgamma_r(x,&signgam);
else else
{ {
#endif
int local_signgam; int local_signgam;
y = __ieee754_gamma_r(x,&local_signgam); y = __ieee754_gamma_r(x,&local_signgam);
if (local_signgam < 0) y = -y; if (local_signgam < 0) y = -y;

View File

@ -28,10 +28,12 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
#endif #endif
{ {
float y; float y;
#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_) if (_LIB_VERSION == _SVID_)
y = __ieee754_lgammaf_r(x,&signgam); y = __ieee754_lgammaf_r(x,&signgam);
else else
{ {
#endif
int local_signgam; int local_signgam;
y = __ieee754_gammaf_r(x,&local_signgam); y = __ieee754_gammaf_r(x,&local_signgam);
if (local_signgam < 0) y = -y; if (local_signgam < 0) y = -y;

View File

@ -33,10 +33,12 @@ static char rcsid[] = "$NetBSD: $";
#endif #endif
{ {
long double y; long double y;
#ifndef _IEEE_LIBM
if (_LIB_VERSION == _SVID_) if (_LIB_VERSION == _SVID_)
y = __ieee754_lgammal_r(x,&signgam); y = __ieee754_lgammal_r(x,&signgam);
else else
{ {
#endif
int local_signgam; int local_signgam;
y = __ieee754_gammal_r(x,&local_signgam); y = __ieee754_gammal_r(x,&local_signgam);
if (local_signgam < 0) y = -y; if (local_signgam < 0) y = -y;

View File

@ -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. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -25,6 +25,8 @@ endif
asm-CPPFLAGS += $(m68k-syntax-flag) asm-CPPFLAGS += $(m68k-syntax-flag)
pic-ccflag = -fpic
# Make sure setjmp.c is compiled with a frame pointer # Make sure setjmp.c is compiled with a frame pointer
CFLAGS-setjmp.c := -fno-omit-frame-pointer CFLAGS-setjmp.c := -fno-omit-frame-pointer

View File

@ -56,8 +56,8 @@ static inline Elf32_Addr
elf_machine_load_address (void) elf_machine_load_address (void)
{ {
Elf32_Addr addr; Elf32_Addr addr;
asm ("1: lea 1b(%%pc), %0\n" asm ("lea _dl_start(%%pc), %0\n\t"
" sub.l 1b@GOTPC(%%pc), %0" "sub.l _dl_start@GOTPC(%%pc), %0"
: "=a" (addr)); : "=a" (addr));
return addr; return addr;
} }

View File

@ -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 */

View File

@ -102,7 +102,7 @@ static struct speed_struct
/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */ /* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */
void int
cfsetspeed (struct termios *termios_p, speed_t speed) cfsetspeed (struct termios *termios_p, speed_t speed)
{ {
size_t cnt; size_t cnt;
@ -112,14 +112,16 @@ cfsetspeed (struct termios *termios_p, speed_t speed)
{ {
cfsetispeed (termios_p, speed); cfsetispeed (termios_p, speed);
cfsetospeed (termios_p, speed); cfsetospeed (termios_p, speed);
return; return 0;
} }
else if (speed == speeds[cnt].value) else if (speed == speeds[cnt].value)
{ {
cfsetispeed (termios_p, speeds[cnt].internal); cfsetispeed (termios_p, speeds[cnt].internal);
cfsetospeed (termios_p, speeds[cnt].internal); cfsetospeed (termios_p, speeds[cnt].internal);
return; return 0;
} }
__set_errno (EINVAL); __set_errno (EINVAL);
return -1;
} }

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 #ifdef __USE_BSD
/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ /* 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 #endif

View File

@ -1,4 +1,4 @@
# @(#)africa 7.18 # @(#)africa 7.19
# This data is by no means authoritative; if you think you know better, # 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 # 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, # Derek Howse, Greenwich time and the discovery of the longitude,
# Oxford University Press (1980). # 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. # For Africa I invented the following time zone abbreviations.
# LMT Local Mean Time # LMT Local Mean Time
# -1:00 AAT Atlantic Africa Time (no longer used) # -1:00 AAT Atlantic Africa Time (no longer used)

View File

@ -1,4 +1,4 @@
# @(#)europe 7.45 # @(#)europe 7.46
# This data is by no means authoritative; if you think you know better, # 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 # 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 # came into force on 16 November. It restates the dates from the EC
# seventh Summer Time Directive.... # seventh Summer Time Directive....
# #
# From Peter Ilieve <peter@aldie.co.uk> (1997-03-28): # From Peter Ilieve <peter@aldie.co.uk> (1997-08-06):
# The [European] Transport Council discussed the proposed Eighth Directive # I now have a copy of the ... Eighth Directive 97/44/EC of the European
# on 11 March and agreed [to] it, so it moves forward to the next stage, # Parliament and of the Council of 22 July 1997 on summer-time arrangements.
# from a Commission proposal to a Common Position.... What this means is: # It runs for 4 years, 1998--2001, and confirms the current rules of
# # last Sunday in March to last Sunday in October....
# - The eighth directive proposal rules have been accepted. # The directive does not apply in overseas territories of the Member States.
# These are the same as the current rules (last Sunday in March and last # It says the Commission should produce a proposal for 2002 and beyond
# Sunday in October). The rules will run until 2001. # by 1 Jan 2000 and this should be adopted by 1 Jan 2001. I doubt that
# # this will happen though....
# - The French have had their request to abandon summer time turned down. # There is no mention of the French desire to abandon the whole idea.
# They have been promised some sort of review in 1999 which might change # France has had a change of government recently so maybe it will
# the rules for 2000 and 2001. # be quietly dropped.
# From Peter Ilieve <peter@memex.co.uk> (1994-03-28): # From Peter Ilieve <peter@memex.co.uk> (1994-03-28):
# The [GB-Eire] end date of 22 October [1995] conflicts with your current rule # 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. # 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: # 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. # 1921 Apr 3, when they began to conform with the rest of Great Britain.
# Actually, Wales was identical after 1880. # Actually, Wales was identical after 1880.
# * Eire had two transitions on 1916 Oct 1. # * Eire had two transitions on 1916 Oct 1.
# It actually just had one transition. # 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. # Actually, it conformed to Britain.
# * GB-Eire changed standard time to 1 hour ahead of GMT on 1968-02-18. # * 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. # Actually, that date saw the usual switch to summer time.
@ -681,7 +681,7 @@
# The following claims by Shanks are possible though doubtful; # The following claims by Shanks are possible though doubtful;
# we'll ignore them for now. # we'll ignore them for now.
# * Jersey, Guernsey, and the Isle of Man did not switch from GMT # * 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. # conform with Great Britain.
# * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00. # * 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 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s 1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 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 1:00 EU CE%sT
# Bulgaria # Bulgaria
@ -1073,7 +1073,7 @@ Zone Europe/Zagreb 1:03:52 - LMT 1884
1:00 - CET 1941 Apr 18 23:00 1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s 1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 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 1:00 EU CE%sT
# Czech Republic # Czech Republic
@ -1572,7 +1572,7 @@ Zone Europe/Skopje 1:25:44 - LMT 1884
1:00 - CET 1941 Apr 18 23:00 1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s 1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 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 1:00 EU CE%sT
# Malta # Malta
@ -1968,7 +1968,7 @@ Zone Europe/Ljubljana 0:58:04 - LMT 1884
1:00 - CET 1941 Apr 18 23:00 1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s 1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 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 1:00 EU CE%sT
# Spain # 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 C-Eur CE%sT 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 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 # 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. # 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 1:00 EU CE%sT
############################################################################### ###############################################################################

View File

@ -7,6 +7,9 @@
# 2. The usual English name for the country, # 2. The usual English name for the country,
# chosen so that alphabetic sorting of subsets produces helpful lists. # 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. # Columns are separated by a single tab.
# The table is sorted by country code. # The table is sorted by country code.
# #
@ -86,6 +89,7 @@ FK Falkland Islands
FM Micronesia FM Micronesia
FO Faeroe Islands FO Faeroe Islands
FR France FR France
FX France, Metropolitan
GA Gabon GA Gabon
GB Britain (UK) GB Britain (UK)
GD Grenada GD Grenada

View File

@ -1,4 +1,4 @@
# @(#)northamerica 7.31 # @(#)northamerica 7.32
# also includes Central America and the Caribbean # also includes Central America and the Caribbean
# This data is by no means authoritative; if you think you know better, # 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 -4:00 - AST
# Montserrat # 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 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 -4:00 - AST
# Nicaragua # Nicaragua

View File

@ -1,4 +1,4 @@
# @(#)southamerica 7.17 # @(#)southamerica 7.18
# This data is by no means authoritative; if you think you know better, # 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 # 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 1989 only - Oct 29 0:00 1:00 S
Rule Uruguay 1990 1992 - Mar Sun>=1 0:00 0 - Rule Uruguay 1990 1992 - Mar Sun>=1 0:00 0 -
Rule Uruguay 1990 1991 - Oct Sun>=21 0:00 1:00 S 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 - Rule Uruguay 1993 only - Feb 28 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28 Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28

View File

@ -231,7 +231,7 @@ MO +2214+11335 Asia/Macao
MP +1512+14545 Pacific/Saipan MP +1512+14545 Pacific/Saipan
MQ +1436-06105 America/Martinique MQ +1436-06105 America/Martinique
MR +1806-01557 Africa/Nouakchott MR +1806-01557 Africa/Nouakchott
MS +1642-06213 America/Montserrat MS +1644-06213 America/Montserrat
MT +3554+01431 Europe/Malta MT +3554+01431 Europe/Malta
MU -2010+05730 Indian/Mauritius MU -2010+05730 Indian/Mauritius
MV +0410+07330 Indian/Maldives MV +0410+07330 Indian/Maldives