8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:03:03 +01:00

NBACKUP-related changes and some clean-up

This commit is contained in:
skidder 2003-09-08 20:23:46 +00:00
parent 86c0719f93
commit 77b17de987
66 changed files with 2935 additions and 2466 deletions

View File

@ -27,7 +27,7 @@
# Contributor(s):
#
#
# $Id: Makefile.in.boot.gpre,v 1.14 2003-05-25 10:44:57 fsg Exp $
# $Id: Makefile.in.boot.gpre,v 1.15 2003-09-08 20:23:31 skidder Exp $
#
ROOT=..
ObjModuleName=boot.gpre
@ -41,7 +41,7 @@ include $(ROOT)/gen/make.shared.variables
@SET_MAKE@
JRDBOOT_Files = dsc.cpp gds.cpp isc_ipc.cpp isc.cpp dls.cpp $(JRDBOOT_Extra_Files)
JRDBOOT_Files = dsc.cpp gds.cpp isc.cpp dls.cpp $(JRDBOOT_Extra_Files)
JRDBOOT_Sources = $(addprefix jrd/, $(JRDBOOT_Files))
JRDBOOT_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(JRDBOOT_Sources))))

View File

@ -27,7 +27,7 @@
# Contributor(s):
#
#
# $Id: Makefile.in.client.util,v 1.12 2003-08-06 16:30:33 skidder Exp $
# $Id: Makefile.in.client.util,v 1.13 2003-09-08 20:23:31 skidder Exp $
#
ROOT=..
ObjModuleName=client.util
@ -41,6 +41,11 @@ include $(ROOT)/gen/make.shared.variables
@SET_MAKE@
LOCKPRINT_Files= print.cpp
LOCKPRINT_Sources = $(addprefix lock/, $(LOCKPRINT_Files))
LOCKPRINT_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(LOCKPRINT_Sources))))
NBACKUP_Sources= utilities/nbackup.cpp jrd/db_alias.cpp
NBACKUP_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(NBACKUP_Sources))))
@ -104,7 +109,7 @@ AllObjects = $(CREATEDB_Object) $(DROP_Object) \
Dependencies = $(AllObjects:.o=.d)
.PHONY: all create_db gstat gds_drop gds_relay gsec fbguard fbmgr_bin nbackup
.PHONY: all create_db gstat gds_drop gds_relay gsec fbguard fbmgr_bin nbackup fb_lock_print
all: $(CLIENT_UTIL_TARGETS)
@ -119,6 +124,11 @@ nbackup: $(LIBFBCLIENT_SO) $(NBACKUP)
$(NBACKUP): $(NBACKUP_Objects)
$(LD) $(LINK_OPTS) $(NBACKUP_Objects) -o $@ -L$(LIB) -lfbclient $(LINK_LIBS)
fb_lock_print: $(LIBFBCLIENT_SO) $(LOCKPRINT)
$(LOCKPRINT): $(LOCKPRINT_Objects)
$(LD) $(LINK_OPTS) $(LOCKPRINT_Objects) -o $@ -L$(LIB) -lfbclient $(LINK_LIBS)
gstat : $(LIBFBCLIENT_SO) $(GSTAT)

View File

@ -27,7 +27,7 @@
# Contributor(s):
#
#
# $Id: Makefile.in.embed.util,v 1.10 2003-08-06 16:30:34 skidder Exp $
# $Id: Makefile.in.embed.util,v 1.11 2003-09-08 20:23:31 skidder Exp $
#
ROOT=..
ObjModuleName=embed.util
@ -41,6 +41,11 @@ include $(ROOT)/gen/make.shared.variables
@SET_MAKE@
LOCKPRINT_Files= print.cpp
LOCKPRINT_Sources = $(addprefix lock/, $(LOCKPRINT_Files))
LOCKPRINT_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(LOCKPRINT_Sources))))
NBACKUP_Files= nbackup.cpp
NBACKUP_Sources = $(addprefix utilities/, $(NBACKUP_Files))
NBACKUP_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(NBACKUP_Sources))))
@ -95,7 +100,7 @@ AllObjects = $(CREATEDB_Objects) $(DROP_Objects) \
Dependencies = $(AllObjects:.o=.d)
.PHONY: create_db gstat gds_drop gds_relay gsec ibguard ibmgr_bin nbackup
.PHONY: create_db gstat gds_drop gds_relay gsec ibguard ibmgr_bin nbackup fb_lock_print
all: $(EMBED_UTIL_TARGETS)
@ -115,6 +120,11 @@ nbackup: $(LIBFBEMBED_SO) $(NBACKUP)
$(NBACKUP): $(NBACKUP_Objects)
$(LD) $(LINK_OPTS) $^ -o $@ -L$(LIB) -lfbembed $(LINK_LIBS)
fb_lock_print: $(LIBFBEMBED_SO) $(LOCKPRINT)
$(LOCKPRINT): $(LOCKPRINT_Objects)
$(LD) $(LINK_OPTS) $^ -o $@ -L$(LIB) -lfbembed $(LINK_LIBS)
gstat : $(LIBFBEMBED_SO) $(GSTAT)

View File

@ -26,7 +26,7 @@
# Contributor(s):
#
#
# $Id: make.defaults,v 1.29 2003-09-01 14:22:50 alexpeshkoff Exp $
# $Id: make.defaults,v 1.30 2003-09-08 20:23:31 skidder Exp $
#
@ -215,6 +215,7 @@ CREATE_DB = $(BIN)/create_db$(EXEC_EXT)
GDS_DROP = $(BIN)/gds_drop$(EXEC_EXT)
GSTAT = $(BIN)/gstat$(EXEC_EXT)
NBACKUP = $(BIN)/nbackup$(EXEC_EXT)
LOCKPRINT = $(BIN)/fb_lock_print$(EXEC_EXT)
GSEC = $(BIN)/gsec$(EXEC_EXT)
GFIX = $(BIN)/gfix$(EXEC_EXT)
GDS_REBUILD = $(BIN)/gds_rebuild$(EXEC_EXT)

View File

@ -17,7 +17,7 @@ WHY_Sources = why.cpp
JRD_ClientFiles = alt.cpp cvt.cpp dsc.cpp dls.cpp \
enc.cpp gds.cpp isc.cpp isc_file.cpp isc_ipc.cpp \
enc.cpp gds.cpp isc.cpp isc_file.cpp \
isc_sync.cpp perf.cpp sch.cpp sdl.cpp status.cpp \
thd.cpp utl.cpp \
$(WHY_Sources)
@ -247,7 +247,7 @@ FBCOMMON_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBCOMMON_So
# Platform Manager
# just in case if make.platform defined some files
OS_SPECIFIC_Files += config_root.cpp path_utils.cpp mod_loader.cpp fbsyslog.cpp guid.cpp
OS_SPECIFIC_Files += config_root.cpp path_utils.cpp mod_loader.cpp fbsyslog.cpp guid.cpp isc_ipc.cpp
OS_SPECIFIC_Sources = $(addprefix $(PLATFORM_PATH)/, $(OS_SPECIFIC_Files))
OS_SPECIFIC_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(OS_SPECIFIC_Sources))))

View File

@ -15,7 +15,7 @@
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Start of file prefix.darwin: $(VERSION) @PLATFORM@
#$Id: prefix.darwin,v 1.10 2003-08-06 16:30:35 skidder Exp $
#$Id: prefix.darwin,v 1.11 2003-09-08 20:23:31 skidder Exp $
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
OS_ServerFiles=inet_server.cpp
@ -25,7 +25,7 @@ DEV_FLAGS=-ggdb -DDARWIN -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Wall
LIB_LINK_OPTIONS:=-shared
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -12,7 +12,7 @@ OS_ServerFiles=inet_server.cpp
LIB_LINK_OPTIONS:=
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -15,7 +15,7 @@
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Start of file prefix.freebsd: $(VERSION) @PLATFORM@
#$Id: prefix.freebsd,v 1.8 2003-08-06 16:30:36 skidder Exp $
#$Id: prefix.freebsd,v 1.9 2003-09-08 20:23:31 skidder Exp $
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
OS_ServerFiles=inet_server.cpp
@ -25,7 +25,7 @@ DEV_FLAGS=-ggdb -DFREEBSD -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Wall
LIB_LINK_OPTIONS:=-shared
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -15,20 +15,22 @@
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Start of file prefix.linux: $(VERSION) $(PLATFORM)
#$Id: prefix.linux,v 1.22 2003-08-19 11:42:45 brodsom Exp $
#$Id: prefix.linux,v 1.23 2003-09-08 20:23:31 skidder Exp $
# 2 Oct 2002, Nickolay Samofatov - Major cleanup
# -fno-builtin is used because GCC 3.0-3.2.2 had bug with builtins expansion
# you may remove it if engine is getting compiled with any other GCC version
PROD_FLAGS=-O3 -march=i586 -mcpu=i686 -fomit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -Dlint -pipe -MMD -fPIC -fmessage-length=0
DEV_FLAGS=-ggdb -DLINUX -DDEBUG_GDS_ALLOC -Dlint -pipe -MMD -p -fPIC -Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -fmessage-length=0
PROD_FLAGS=-O3 -march=i586 -mcpu=i686 -fomit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -fmessage-length=0
# uncomment if you need PROD_BUILD engine that is possible to debug
#PROD_FLAGS=-ggdb -O3 -march=i586 -mcpu=i686 -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -fmessage-length=0
DEV_FLAGS=-ggdb -DLINUX -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -fmessage-length=0
OS_ServerFiles=inet_server.cpp
LIB_LINK_OPTIONS:=-shared
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_relay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -31,8 +31,8 @@ LIB_LINK_OPTIONS:=-shared -Wl,--add-stdcall-alias
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
LIB_GUI:= -mwindows -lcomctl32 -lgdi32
EMBED_UTIL_TARGETS:=gstat gsec nbackup
CLIENT_UTIL_TARGETS:=gstat gsec ibguard instsvc instreg nbackup
EMBED_UTIL_TARGETS:=gstat gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS:=gstat gsec ibguard instsvc instreg nbackup fb_lock_print
WIN_IPSERVER_Files:=ipserver.cpp alli.cpp
Physical_IO_Module=os/win32/winnt.cpp

View File

@ -17,7 +17,7 @@
#
# Erik Kunze, Philosys GmbH, <kunze@philosys.de>
#
# $Id: prefix.sinixz,v 1.18 2003-08-06 16:30:36 skidder Exp $
# $Id: prefix.sinixz,v 1.19 2003-09-08 20:23:31 skidder Exp $
#
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
@ -39,8 +39,8 @@ OS_ServerFiles=inet_server.cpp
LIB_LINK_OPTIONS:=-shared
LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -57,7 +57,7 @@ OS_ServerFiles=inet_server.cpp
LIB_LINK_OPTIONS:= -G
LIB_LINK_RPATH:=-R
LIB_LINK_SONAME:=-h
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -19,7 +19,7 @@
#
# Use SOLX86 to identify x86 version of Solaris. Neil McCalden
#
# $Id: prefix.solx86,v 1.21 2003-08-08 06:29:52 kkuznetsov Exp $
# $Id: prefix.solx86,v 1.22 2003-09-08 20:23:31 skidder Exp $
#
# Start of file prefix.solaris X 86 : $(VERSION) $(PLATFORM)
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
@ -63,7 +63,7 @@ LIB_LINK_OPTIONS:= -G
LIB_LINK_RPATH:=-R
LIB_LINK_SONAME:=-h
#LINK_OPTS:= $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/lib $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/intl
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -18,7 +18,7 @@
#
# Use SOLX86 to identify x86 version of Solaris. Neil McCalden
#
# $Id: prefix.solx86gcc,v 1.3 2003-08-06 16:30:36 skidder Exp $
# $Id: prefix.solx86gcc,v 1.4 2003-09-08 20:23:31 skidder Exp $
#
# Start of file prefix.solaris X 86 : $(VERSION) $(PLATFORM)
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
@ -62,7 +62,7 @@ LIB_LINK_OPTIONS:= -G
LIB_LINK_RPATH:=-R
LIB_LINK_SONAME:=-h
#LINK_OPTS:= $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/lib $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/intl
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.154 2003-08-22 10:26:06 aafemt Exp $
dnl $Id: configure.in,v 1.155 2003-09-08 20:23:29 skidder Exp $
dnl ############################# INITIALISATION ###############################
@ -610,6 +610,7 @@ mkdir -p temp/client.util/utilities/guard
mkdir -p temp/client.util/utilities/gsec
mkdir -p temp/client.util/utilities/gstat
mkdir -p temp/client.util/utilities/install
mkdir -p temp/client.util/lock
mkdir -p temp/client.util/iscguard
mkdir -p temp/client.util/remote/os/win32
mkdir -p temp/client.util/jrd/os/win32
@ -640,6 +641,7 @@ mkdir -p temp/libfbstatic/common/config
mkdir -p temp/embed.lockmgr/lock
mkdir -p temp/embed.util/utilities/gstat
mkdir -p temp/embed.util/utilities/gsec
mkdir -p temp/embed.util/lock
mkdir -p temp/embed.gbak/burp
mkdir -p temp/embed.gfix/alice
mkdir -p temp/embed.isql/isql

View File

@ -3,24 +3,37 @@
* MODULE: alloc.cpp
* DESCRIPTION: Memory Pool Manager (based on B+ tree)
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: alloc.cpp,v 1.32 2003-09-08 20:23:32 skidder Exp $
*
*/
#include "../../include/firebird.h"

View File

@ -3,26 +3,39 @@
* MODULE: alloc.h
* DESCRIPTION: Memory Pool Manager (based on B+ tree)
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* STL allocator is based on one by Mike Nordell and John Bellardo
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: alloc.h,v 1.25 2003-09-08 20:23:32 skidder Exp $
*
*/
#ifndef ALLOC_H

View File

@ -3,24 +3,37 @@
* MODULE: class_perf.cpp
* DESCRIPTION: Class library performance measurements
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: class_perf.cpp,v 1.8 2003-09-08 20:23:32 skidder Exp $
*
*/
#include "tree.h"

View File

@ -3,24 +3,37 @@
* MODULE: class_test.cpp
* DESCRIPTION: Class library integrity tests
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: class_test.cpp,v 1.10 2003-09-08 20:23:32 skidder Exp $
*
*/
#include "../../include/firebird.h"

View File

@ -3,24 +3,37 @@
* MODULE: locks.h
* DESCRIPTION: Single-state locks
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: locks.h,v 1.8 2003-09-08 20:23:32 skidder Exp $
*
*/
#ifndef LOCKS_H

View File

@ -3,24 +3,37 @@
* MODULE: rwlock.h
* DESCRIPTION: Read/write multi-state locks
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: rwlock.h,v 1.5 2003-09-08 20:23:32 skidder Exp $
*
*/
#ifndef RWLOCK_H

View File

@ -3,24 +3,37 @@
* MODULE: tree.h
* DESCRIPTION: Generic In-memory B+ Tree
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: tree.h,v 1.19 2003-09-08 20:23:32 skidder Exp $
*
*/
#ifndef TREE_H

View File

@ -3,24 +3,37 @@
* MODULE: vector.h
* DESCRIPTION: static array of simple elements
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: vector.h,v 1.3 2003-09-08 20:23:32 skidder Exp $
*
*/
#ifndef VECTOR_H

View File

@ -102,7 +102,7 @@
/* Can't include ../jrd/err_proto.h here because it pulls jrd.h. */
#if !defined(JRD_ERR_PROTO_H)
extern "C" TEXT *DLL_EXPORT ERR_string(const TEXT*, int);
TEXT *DLL_EXPORT ERR_string(const TEXT*, int);
#endif
ASSERT_FILENAME

View File

@ -30,7 +30,7 @@
* John Bellardo <bellardo@cs.ucsd.edu>
*
*
* $Id: firebird.h,v 1.13 2003-08-10 15:43:21 skidder Exp $
* $Id: firebird.h,v 1.14 2003-09-08 20:23:34 skidder Exp $
*
*/
@ -71,4 +71,8 @@
#define MULTI_THREAD 1
#endif
#ifndef NULL
#define NULL 0L
#endif
#endif /* INCLUDE_Firebird */

View File

@ -187,6 +187,143 @@ static void unmark(TDBB, WIN *);
#define DUMMY_CHECKSUM 12345
bool set_write_direction(DBB dbb, BDB bdb, SSHORT direction) {
#ifdef SUPERSERVER
if (bdb->bdb_write_direction == BDB_write_normal ||
bdb->bdb_write_direction == BDB_write_both)
{
if (direction != BDB_write_normal && direction != BDB_write_both)
dbb->backup_manager->release_sw_database_lock();
} else {
if (direction == BDB_write_normal || direction == BDB_write_both)
dbb->backup_manager->get_sw_database_lock(true, true);
}
bdb->bdb_write_direction = direction;
#else
LCK_ast_inhibit();
switch(bdb->bdb_write_direction) {
case BDB_write_normal:
case BDB_write_both:
switch (direction) {
case BDB_write_diff:
dbb->backup_manager->increment_diff_use_count();
dbb->backup_manager->release_sw_database_lock();
break;
case BDB_write_undefined:
dbb->backup_manager->release_sw_database_lock();
break;
}
break;
case BDB_write_diff:
switch(direction) {
case BDB_write_normal:
case BDB_write_both:
dbb->backup_manager->decrement_diff_use_count();
bdb->bdb_write_direction = direction;
// We ask this function to enable signals
if (!dbb->backup_manager->get_sw_database_lock(true, true)) {
bdb->bdb_write_direction = BDB_write_undefined;
return false;
}
return true;
case BDB_write_undefined:
dbb->backup_manager->decrement_diff_use_count();
}
break;
case BDB_write_undefined:
switch (direction) {
case BDB_write_diff:
dbb->backup_manager->increment_diff_use_count();
break;
case BDB_write_normal:
case BDB_write_both:
bdb->bdb_write_direction = direction;
// We ask this function to enable signals
if (!dbb->backup_manager->get_sw_database_lock(true, true)) {
bdb->bdb_write_direction = BDB_write_undefined;
return false;
}
return true;
}
break;
}
bdb->bdb_write_direction = direction;
LCK_ast_enable();
#endif
return true;
}
void CCH_flush_database(TDBB tdbb) {
/**************************************
*
* C C H _ f l u s h _ d a t a b a s e
*
**************************************
*
* Functional description
* Flush all buffers coming from database file.
* May be called from AST
*
**************************************/
SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database;
BCB bcb = dbb->dbb_bcb;
#ifdef SUPERSERVER
// This is called on architectures with shared buffer cache (like SuperServer)
// Determine a list of pages to flush
Firebird::BePlusTree<ULONG, ULONG, Firebird::MemoryPool> pages(tdbb->tdbb_default);
BCB_MUTEX_ACQUIRE;
try {
for (ULONG i = 0; (bcb = dbb->dbb_bcb) && i < bcb->bcb_count; i++) {
BDB bdb = bcb->bcb_rpt[i].bcb_bdb;
if (bdb->bdb_length)
continue;
if (!(bdb->bdb_flags & (BDB_dirty | BDB_db_dirty)) ||
bdb->bdb_write_direction == BDB_write_diff) continue;
// As the result we can add a number of redundant pages to flush
// that were marked as dirty, but not released yet. This should
// not create problems except that we'll loose some time later
// during the flush itself
pages.add(bdb->bdb_page);
}
} catch(std::exception&) {
// Handle out-of-memory error
BCB_MUTEX_RELEASE;
throw;
}
BCB_MUTEX_RELEASE;
// Now, apply force to flush this pages. Flush pages in order.
if (pages.getFirst()) do {
WIN window;
window.win_page = pages.current();
window.win_flags = 0;
PAG page = CCH_FETCH(tdbb, &window, LCK_write, pag_undefined);
CCH_MARK_MUST_WRITE(tdbb, &window);
CCH_RELEASE(tdbb, &window);
} while(pages.getNext());
#else
/* Do some fancy footwork to make sure that pages are
not removed from the btc tree at AST level. Then
restore the flag to whatever it was before. */
bool keep_pages = bcb->bcb_flags & BCB_keep_pages;
dbb->dbb_bcb->bcb_flags |= BCB_keep_pages;
for (ULONG i = 0; (bcb = dbb->dbb_bcb) && i < bcb->bcb_count; i++) {
BDB bdb = bcb->bcb_rpt[i].bcb_bdb;
if (bdb->bdb_length)
continue;
if (!(bdb->bdb_flags & (BDB_dirty | BDB_db_dirty)) ||
bdb->bdb_write_direction == BDB_write_diff) continue;
down_grade(tdbb, bdb);
}
if (!keep_pages)
bcb->bcb_flags &= ~BCB_keep_pages;
#endif
}
USHORT CCH_checksum(BDB bdb)
{
@ -920,27 +1057,23 @@ void CCH_fetch_page(
persistant (more than 3 times) error out of the routine by
calling CCH_unwind, and eventually punting out. */
if (!dbb->backup_manager->lock_state(false) ||
!dbb->backup_manager->actualize_state(status))
if (!dbb->backup_manager->lock_state(false))
{
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
}
int bak_state = dbb->backup_manager->get_state();
ULONG diff_page = 0;
if (bak_state == nbak_state_stalled || bak_state == nbak_state_merge) {
if (!dbb->backup_manager->lock_alloc(false) ||
!dbb->backup_manager->actualize_alloc(status))
if (!dbb->backup_manager->lock_alloc(false))
{
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_alloc();
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
}
diff_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
TRACE3("Reading page %d, state=%d, diff page=%d", bdb->bdb_page, bak_state, diff_page);
NBAK_TRACE(("Reading page %d, state=%d, diff page=%d", bdb->bdb_page, bak_state, diff_page));
}
if (bak_state == nbak_state_normal ||
@ -951,7 +1084,8 @@ void CCH_fetch_page(
(!diff_page || (bdb->bdb_page < dbb->backup_manager->get_backup_pages())))
)
{
TRACE3("Reading page %d, state=%d, diff page=%d from DISK", bdb->bdb_page, bak_state, diff_page);
NBAK_TRACE(("Reading page %d, state=%d, diff page=%d from DISK",
bdb->bdb_page, bak_state, diff_page));
// Read page from disk as normal
while (!PIO_read(file, bdb, page, status)) {
if (!read_shadow) {
@ -989,12 +1123,47 @@ void CCH_fetch_page(
page->pag_scn() < dbb->backup_manager->get_current_scn())
)))
{
TRACE3("Reading page %d, state=%d, diff page=%d from DIFFERENCE", bdb->bdb_page, bak_state, diff_page);
if (!dbb->backup_manager->read_difference(status, diff_page, page)) {
NBAK_TRACE(("Reading page %d, state=%d, diff page=%d from DIFFERENCE",
bdb->bdb_page, bak_state, diff_page));
if (!dbb->backup_manager->read_difference(diff_page, page)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
}
if (page->pag_type == pag_undefined) {
// Page was marked as allocated inside the difference file, but not really used
// this is very rare, but possible case (after certain errors).
// Read (or re-read) page from database
NBAK_TRACE(("Re-reading page %d, state=%d, diff page=%d from DISK",
bdb->bdb_page, bak_state, diff_page));
while (!PIO_read(file, bdb, page, status)) {
if (!read_shadow) {
break;
}
#ifdef SUPERSERVER
THREAD_ENTER;
#endif
if (!CCH_rollover_to_shadow(dbb, file, FALSE)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
}
if (file != dbb->dbb_file)
file = dbb->dbb_file;
else {
if (retryCount++ == 3) {
ib_fprintf(ib_stderr,
"IO error loop Unwind to avoid a hang\n");
PAGE_LOCK_RELEASE(bdb->bdb_lock);
dbb->backup_manager->unlock_state();
CCH_unwind(tdbb, TRUE);
}
}
#ifdef SUPERSERVER
THREAD_EXIT;
#endif
}
}
}
dbb->backup_manager->unlock_state();
@ -2128,6 +2297,18 @@ void CCH_recover_shadow(TDBB tdbb, SBM sbm_rec)
}
void invalidate_and_release_buffer(TDBB tdbb, BDB bdb) {
// This function should be called before difference processing is done.
// So there should be no need to no need to release difference locks though
DBB dbb = tdbb->tdbb_database;
bdb->bdb_flags |= BDB_not_valid;
bdb->bdb_flags &= ~BDB_dirty;
set_write_direction(dbb, bdb, BDB_write_undefined);
TRA_invalidate(dbb, bdb->bdb_transactions);
bdb->bdb_transactions = 0;
release_bdb(tdbb, bdb, FALSE, FALSE, FALSE);
}
void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
{
/**************************************
@ -2145,7 +2326,6 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
DBB dbb;
BDB bdb;
SSHORT use_count;
BOOLEAN marked;
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
@ -2173,7 +2353,91 @@ void CCH_release(TDBB tdbb, WIN * window, BOOLEAN release_tail)
if (bdb->bdb_use_count == 1)
{
marked = (bdb->bdb_flags & BDB_marked) ? TRUE : FALSE;
if (bdb->bdb_flags & BDB_dirty) {
SSHORT write_direction;
// We are going to release a page that is dirty. Lets determine
// location of the page in difference file and write destination
// so BDB AST handlers can safely use this information
if (!dbb->backup_manager->lock_state(true)) {
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
#ifndef SUPERSERVER
bdb->bdb_diff_generation = dbb->backup_manager->get_current_generation();
#endif
if (bdb->bdb_page != HEADER_PAGE) // SCN of header page is adjusted in nbak.cpp
bdb->bdb_buffer->pag_scn() = dbb->backup_manager->get_current_scn(); // Set SCN for the page
int backup_state = dbb->backup_manager->get_state();
switch (backup_state) {
case nbak_state_normal:
write_direction = BDB_write_normal;
break;
case nbak_state_stalled:
write_direction = BDB_write_diff;
break;
case nbak_state_merge:
if (tdbb->tdbb_flags & TDBB_backup_merge ||
bdb->bdb_page < dbb->backup_manager->get_backup_pages())
{
write_direction = BDB_write_normal;
} else
write_direction = BDB_write_both;
break;
}
switch (write_direction) {
case BDB_write_diff:
if (!dbb->backup_manager->lock_alloc(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
bdb->bdb_difference_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
if (!bdb->bdb_difference_page) {
if (!dbb->backup_manager->lock_alloc_write(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
bdb->bdb_difference_page = dbb->backup_manager->allocate_difference_page(bdb->bdb_page);
dbb->backup_manager->unlock_alloc_write();
if (!bdb->bdb_difference_page) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
NBAK_TRACE(("Allocate difference page %d for database page %d",
bdb->bdb_difference_page, bdb->bdb_page));
} else {
NBAK_TRACE(("Map existing difference page %d to database page %d",
bdb->bdb_difference_page, bdb->bdb_page));
}
break;
case BDB_write_both:
if (!dbb->backup_manager->lock_alloc(true)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
bdb->bdb_difference_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
if (bdb->bdb_difference_page) {
NBAK_TRACE(("Map existing difference page %d to database page %d (write_both)",
bdb->bdb_difference_page, bdb->bdb_page));
} else {
// This may really happen. Database file can grow while in merge mode
write_direction = BDB_write_normal;
}
break;
}
if (!set_write_direction(dbb, bdb, write_direction)) {
dbb->backup_manager->unlock_state();
invalidate_and_release_buffer(tdbb, bdb);
CCH_unwind(tdbb, TRUE);
}
dbb->backup_manager->unlock_state();
}
bool marked = bdb->bdb_flags & BDB_marked;
bdb->bdb_flags &= ~(BDB_writer | BDB_marked | BDB_faked);
if (marked)
{
@ -2411,7 +2675,6 @@ void DLL_EXPORT CCH_shutdown_database(DBB dbb)
#endif
}
void CCH_unwind(TDBB tdbb, BOOLEAN punt)
{
/**************************************
@ -2469,9 +2732,11 @@ void CCH_unwind(TDBB tdbb, BOOLEAN punt)
(page->pag_type == pag_transactions))
{
++bdb->bdb_use_count;
bdb->bdb_flags &=
~(BDB_dirty | BDB_writer | BDB_marked | BDB_faked |
BDB_db_dirty);
// Adjust backup page locks
if (bdb->bdb_flags & BDB_dirty)
set_write_direction(dbb, bdb, BDB_write_undefined);
bdb->bdb_flags &= ~(BDB_dirty |
BDB_writer | BDB_marked | BDB_faked | BDB_db_dirty);
PAGE_LOCK_RELEASE(bdb->bdb_lock);
--bdb->bdb_use_count;
}
@ -3690,7 +3955,11 @@ static BOOLEAN down_grade(TDBB tdbb, BDB bdb)
if (dbb->dbb_flags & DBB_bugcheck) {
PAGE_LOCK_RELEASE(bdb->bdb_lock);
bdb->bdb_ast_flags &= ~BDB_blocking;
// Release backup pages lock as buffer is no longer dirty
if (bdb->bdb_flags & BDB_dirty) {
bdb->bdb_flags &= ~BDB_dirty;
set_write_direction(dbb, bdb, BDB_write_undefined);
}
return TRUE;
}
@ -3760,7 +4029,9 @@ static BOOLEAN down_grade(TDBB tdbb, BDB bdb)
if (invalid
|| !write_page(tdbb, bdb, FALSE, tdbb->tdbb_status_vector, TRUE)) {
bdb->bdb_flags |= BDB_not_valid;
// Release backup pages lock
bdb->bdb_flags &= ~BDB_dirty;
set_write_direction(dbb, bdb, BDB_write_undefined);
bdb->bdb_ast_flags &= ~BDB_blocking;
TRA_invalidate(dbb, bdb->bdb_transactions);
bdb->bdb_transactions = 0;
@ -5615,91 +5886,47 @@ static BOOLEAN write_page(
shadows, making a special case of the header page */
if (bdb->bdb_page >= 0) {
if (!dbb->backup_manager->lock_state(true) ||
!dbb->backup_manager->actualize_state(status))
{
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
if (bdb->bdb_write_direction == BDB_write_undefined) {
dbb->dbb_flags |= DBB_bugcheck;
status[0] = isc_arg_gds;
status[1] = gds_bug_check;
status[2] = gds_arg_string;
status[3] = (ISC_STATUS)ERR_cstring("Undefined page write direction");
status[4] = gds_arg_end;
return FALSE;
}
if (bdb->bdb_page != HEADER_PAGE) // SCN of header page is adjusted in nbak.cpp
page->pag_scn() = dbb->backup_manager->get_current_scn(); // Set SCN for the page
page->pag_checksum = CCH_checksum(bdb);
int backup_state = dbb->backup_manager->get_state();
if (backup_state == nbak_state_stalled ||
// We write pages that were beyond the end of file to difference file too
// This is because we cannot read page from main database file to choose
(backup_state == nbak_state_merge && !(tdbb->tdbb_flags & TDBB_backup_merge) &&
bdb->bdb_page >= dbb->backup_manager->get_backup_pages()))
if (bdb->bdb_write_direction == BDB_write_diff ||
(bdb->bdb_write_direction == BDB_write_both
#ifndef SUPERSERVER
&& bdb->bdb_diff_generation == dbb->backup_manager->get_current_generation()
#endif
))
{
// Write to difference file
if (!dbb->backup_manager->lock_alloc(true) ||
!dbb->backup_manager->actualize_alloc(status))
#ifdef NBAK_DEBUG
// We cannot call normal trace functions here as they are signal-unsafe
char buffer[1000], *ptr = buffer;
strcpy(ptr, "NBAK,Write page "); ptr += strlen(ptr);
gds__ulstr(ptr, bdb->bdb_page, 0, 0); ptr += strlen(ptr);
strcpy(ptr, " at offset "); ptr += strlen(ptr);
gds__ulstr(ptr, bdb->bdb_difference_page, 0, 0); ptr += strlen(ptr);
strcpy(ptr, " in difference file");
gds__trace(buffer);
#endif
if (!dbb->backup_manager->write_difference(
status, bdb->bdb_difference_page, bdb->bdb_buffer))
{
dbb->backup_manager->unlock_alloc();
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
diff_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
dbb->backup_manager->unlock_alloc();
if (diff_page) {
// Simple case. Write to difference file directly
if (!dbb->backup_manager->write_difference(status, diff_page, bdb->bdb_buffer)) {
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
TRACE2("Write page %u at offset %u (existing) in difference file", bdb->bdb_page, diff_page);
} else if (backup_state == nbak_state_stalled) {
if (!dbb->backup_manager->lock_alloc_write(true) ||
!dbb->backup_manager->actualize_alloc(status))
{
dbb->backup_manager->unlock_alloc_write();
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
diff_page = dbb->backup_manager->get_page_index(bdb->bdb_page);
if (diff_page) {
if (!dbb->backup_manager->write_difference(status, diff_page, bdb->bdb_buffer)) {
dbb->backup_manager->unlock_alloc_write();
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
TRACE2("Write page %u at offset %u (appeared) in difference file", bdb->bdb_page, diff_page);
} else {
diff_page = dbb->backup_manager->get_next_page();
if (!dbb->backup_manager->write_difference(status, diff_page, bdb->bdb_buffer)) {
dbb->backup_manager->unlock_alloc_write();
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
TRACE2("Write page %u at offset %u (created) in difference file", bdb->bdb_page, diff_page);
if (!dbb->backup_manager->mark_alloc(status, bdb->bdb_page)) {
dbb->backup_manager->unlock_alloc_write();
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
}
dbb->backup_manager->unlock_alloc_write();
}
}
if (backup_state == nbak_state_stalled) {
if (bdb->bdb_write_direction == BDB_write_diff) {
// We finished. Adjust transaction accounting and get ready for exit
if (bdb->bdb_page == HEADER_PAGE)
dbb->dbb_last_header_write =
((HDR) page)->hdr_next_transaction;
set_write_direction(dbb, bdb, BDB_write_undefined);
} else {
// We need to write our pages to main database files
#ifdef SUPERSERVER
@ -5713,7 +5940,6 @@ static BOOLEAN write_page(
if (!CCH_rollover_to_shadow(dbb, file, inAst)) {
bdb->bdb_flags |= BDB_io_error;
dbb->dbb_flags |= DBB_suspend_bgio;
dbb->backup_manager->unlock_state();
return FALSE;
}
#ifdef SUPERSERVER
@ -5731,9 +5957,8 @@ static BOOLEAN write_page(
if (dbb->dbb_shadow)
result =
CCH_write_all_shadows(tdbb, 0, bdb, status, 0, inAst);
set_write_direction(dbb, bdb, BDB_write_undefined);
}
dbb->backup_manager->unlock_state();
}
#ifdef SUPERSERVER

View File

@ -98,6 +98,11 @@ class bdb : public pool_alloc<type_bdb>
USHORT bdb_length; /* Length of journal records */
SSHORT bdb_use_count; /* Number of active users */
SSHORT bdb_scan_count; /* concurrent sequential scans */
USHORT bdb_write_direction; /* Where to write buffer */
ULONG bdb_difference_page; /* Number of page in difference file */
SLONG bdb_diff_generation; /* Number of backup/restore cycle for
this database in current process.
Used in CS only. */
struct tdbb*bdb_shared[BDB_max_shared]; /* threads holding shared latches */
};
typedef bdb *BDB;
@ -125,6 +130,13 @@ typedef bdb *BDB;
#define BDB_blocking 1 /* a blocking ast was sent while page locked */
/* bdb_write_direction values */
#define BDB_write_undefined 0
#define BDB_write_normal 1
#define BDB_write_diff 2
#define BDB_write_both 3
/* PRE -- Precedence block */

View File

@ -67,6 +67,7 @@ void CCH_release_journal(TDBB, SLONG);
BOOLEAN CCH_rollover_to_shadow(struct dbb *, struct fil *, BOOLEAN);
void CCH_unwind(TDBB, BOOLEAN);
BOOLEAN CCH_validate(struct win *);
void CCH_flush_database(TDBB tdbb);
BOOLEAN CCH_write_all_shadows(TDBB, struct sdw *, struct bdb *,
ISC_STATUS *, USHORT, BOOLEAN);

View File

@ -49,7 +49,7 @@
*
*/
/*
$Id: common.h,v 1.80 2003-09-01 07:58:04 brodsom Exp $
$Id: common.h,v 1.81 2003-09-08 20:23:35 skidder Exp $
*/
#ifndef JRD_COMMON_H
@ -73,8 +73,6 @@ $Id: common.h,v 1.80 2003-09-01 07:58:04 brodsom Exp $
#include "../include/fb_types.h"
#endif
/*
do not use links in source code to maintain platform neutraility
*/
@ -129,7 +127,6 @@ $Id: common.h,v 1.80 2003-09-01 07:58:04 brodsom Exp $
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
#endif /* LINUX */
/*****************************************************
@ -205,8 +202,6 @@ int syslog(int pri, char *fmt, ...);
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
//format for __LINE__
#define LINEFORMAT "d"
@ -250,7 +245,6 @@ typedef RETSIGTYPE (*SIG_FPTR) ();
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
#endif /* Darwin Platforms */
@ -283,7 +277,6 @@ typedef RETSIGTYPE (*SIG_FPTR) (int);
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
#endif /* FREEBSD */
/*****************************************************
@ -315,7 +308,6 @@ typedef RETSIGTYPE (*SIG_FPTR) (int);
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* NETBSD */
@ -433,7 +425,6 @@ typedef RETSIGTYPE (*SIG_FPTR) ();
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
#endif /* sun */
@ -474,7 +465,6 @@ typedef RETSIGTYPE (*SIG_FPTR) (int);
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* hpux */
@ -503,7 +493,6 @@ typedef unsigned int64 UATOM;
#define FINI_ERROR 44
#define STARTUP_ERROR 46 /* this is also used in iscguard.h, make sure these match */
typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* VMS */
@ -546,7 +535,6 @@ typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* IBM PowerPC */
typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* IBM AIX */
@ -616,7 +604,6 @@ typedef unsigned __int64 UINT64;
#endif
#endif
typedef RETSIGTYPE (CLIB_ROUTINE * SIG_FPTR) (int);
#endif /* WIN_NT */
// 23 Sep 2002, skidder, ALLOC_LIB_MEMORY moved here,
@ -653,7 +640,6 @@ typedef RETSIGTYPE (CLIB_ROUTINE * SIG_FPTR) (int);
#define setregid(rgid,egid) setgid(egid)
*/
typedef RETSIGTYPE (*SIG_FPTR) ();
#endif /* SCO_EV */
/*****************************************************
@ -721,10 +707,6 @@ typedef RETSIGTYPE (*SIG_FPTR) ();
#define STARTUP_ERROR 2 /* this is also used in iscguard.h, make sure these match */
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifndef TRUE
#define TRUE 1
#endif
@ -904,28 +886,33 @@ typedef struct
#define FREE_LIB_MEMORY(block) gds__free (block)
#endif
// This macros are used to workaround shortage of standard conformance
// in Microsoft compilers. They could be replaced with normal procedure
// and generic macro if MSVC would support C99-style __VA_ARGS__
#define DEFINE_TRACE_ROUTINE(routine) void routine(const char* message, ...)
#define IMPLEMENT_TRACE_ROUTINE(routine, subsystem) \
void routine(const char* message, ...) { \
static const char name_facility[] = subsystem ","; \
char buffer[1000]; \
strcpy(buffer, name_facility); \
char *ptr = buffer + sizeof(name_facility)-1; \
va_list params; \
va_start(params, message); \
vsnprintf(ptr, sizeof(buffer)-sizeof(name_facility), message, params); \
va_end(params); \
gds__trace(buffer); \
}
#ifdef DEV_BUILD
/* Define any debugging symbols and macros here. This
ifdef will be executed during development builds. */
//#ifdef WIN_NT
#define TRACE(msg) gds__log (msg)
#define TRACE1(msg,p1) gds__log (msg,p1)
#define TRACE2(msg,p1,p2) gds__log (msg,p1,p2)
#define TRACE3(msg,p1,p2,p3) gds__log (msg,p1,p2,p3)
#define TRACE4(msg,p1,p2,p3,p4) gds__log (msg,p1,p2,p3,p4)
#define DEV_REPORT(msg) gds__log (msg)
//#endif
#define TRACE(msg) gds__trace (msg)
#ifndef TRACE
#define TRACE(msg) ib_fprintf (ib_stderr,msg)
#define TRACE1(msg,p1) ib_fprintf (ib_stderr,msg,p1)
#define TRACE2(msg,p1,p2) ib_fprintf (ib_stderr,msg,p1,p2)
#define TRACE3(msg,p1,p2,p3) ib_fprintf (ib_stderr,msg,p1,p2,p3)
#define TRACE4(msg,p1,p2,p3,p4) ib_fprintf (ib_stderr,msg,p1,p2,p3,p4)
#ifdef WIN_NT
#define DEV_REPORT(msg) gds__log (msg)
#endif
#ifndef DEV_REPORT
@ -947,13 +934,15 @@ void GDS_breakpoint(int);
#endif /* DEV_BUILD */
#ifndef DEV_BUILD
#ifndef DEV_REPORT
#define DEV_REPORT(msg) gds__log (msg)
#endif
#ifndef BREAKPOINT
#define BREAKPOINT(x) /* nothing */
#endif
#ifndef TRACE
#define TRACE(msg) /* nothing */
#define TRACE1(msg,p1) /* nothing */
#define TRACE2(msg,p1,p2) /* nothing */
#define TRACE3(msg,p1,p2,p3) /* nothing */
#define TRACE4(msg,p1,p2,p3,p4) /* nothing */
#endif
#endif

View File

@ -1090,10 +1090,8 @@ static bool add_difference( TDBB tdbb, SSHORT phase, DFW work, JRD_TRA transacti
return true;
case 3:
if (!dbb->backup_manager->lock_state(true))
ERR_post(gds_lock_conflict, 0);
try {
if (!dbb->backup_manager->actualize_state(tdbb->tdbb_status_vector))
ERR_punt();
try {
if (dbb->backup_manager->get_state() != nbak_state_normal)
{
ERR_post(gds_no_meta_update,
@ -1141,17 +1139,15 @@ static bool delete_difference( TDBB tdbb,
return true;
case 3:
if (!dbb->backup_manager->lock_state(true))
ERR_post(gds_lock_conflict, 0);
try {
if (!dbb->backup_manager->actualize_state(tdbb->tdbb_status_vector))
ERR_punt();
try {
if (dbb->backup_manager->get_state() != nbak_state_normal)
{
ERR_post(gds_no_meta_update,
gds_arg_gds, gds_wrong_backup_state, 0);
}
dbb->backup_manager->set_difference(NULL);
} catch(const std::exception&){
} catch(const std::exception&) {
dbb->backup_manager->unlock_state();
throw;
}

View File

@ -56,9 +56,6 @@
#define JRD_FAILURE_UNKNOWN "<UNKNOWN>" /* Used when buffer fails */
extern "C" {
static TEXT* jrd_failures = NULL;
static TEXT* jrd_failures_ptr = NULL;
@ -645,5 +642,3 @@ static void internal_error(ISC_STATUS status, int number)
ERR_post(status, gds_arg_string, ERR_cstring(errmsg), 0);
}
#endif
} /* extern "C" */

View File

@ -43,10 +43,6 @@ typedef enum idx_e {
#define CORRUPT(number) ERR_corrupt (number)
#define IBERROR(number) ERR_error (number)
#ifdef __cplusplus
extern "C" {
#endif
BOOLEAN DLL_EXPORT ERR_post_warning(ISC_STATUS, ...);
void ERR_assert(const TEXT*, int);
void DLL_EXPORT ERR_bugcheck(int);
@ -60,21 +56,9 @@ void DLL_EXPORT ERR_punt(void);
void DLL_EXPORT ERR_warning(ISC_STATUS, ...);
void DLL_EXPORT ERR_log(int, int, const TEXT *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* REQUESTER */
#ifdef __cplusplus
extern "C" {
#endif
const TEXT* DLL_EXPORT ERR_cstring(const TEXT*);
const TEXT* DLL_EXPORT ERR_string(const TEXT*, int);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* JRD_ERR_PROTO_H */

View File

@ -42,7 +42,8 @@
#include "../jrd/isc_s_proto.h"
#include "../jrd/sch_proto.h"
#include "../jrd/thd_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/err_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../common/config/config.h"
#ifdef HAVE_SYS_TYPES_H
@ -53,14 +54,6 @@
#include <unistd.h>
#endif
#pragma FB_COMPILER_MESSAGE("FIXFIXFIX!!! - DANGER!")
// We currently can't include jrd/err_proto.h to get the function
// declaration. :-<
extern "C" {
extern void DLL_EXPORT ERR_bugcheck_msg(const TEXT *);
}
#ifdef UNIX
#include <signal.h>
#define EVENT_SIGNAL SIGUSR2
@ -100,7 +93,7 @@ static void delete_event(EVNT);
static void delete_process(SLONG);
static void delete_request(EVT_REQ);
static void delete_session(SLONG);
static AST_TYPE deliver(void);
static AST_TYPE deliver(void* arg);
static void deliver_request(EVT_REQ);
static void exit_handler(void *);
static EVNT find_event(USHORT, TEXT *, EVNT);
@ -984,7 +977,7 @@ static void delete_session(SLONG session_id)
}
static AST_TYPE deliver(void)
static AST_TYPE deliver(void* arg)
{
/**************************************
*
@ -1676,7 +1669,7 @@ static void THREAD_ROUTINE watcher_thread(void *dummy)
value = ISC_event_clear(process->prb_event);
RELEASE;
deliver();
deliver(NULL);
ACQUIRE;
process = (PRB) ABS_PTR(EVENT_process_offset);
RELEASE;

View File

@ -52,6 +52,7 @@
#include "../jrd/iberr.h"
#include "../jrd/gds_proto.h"
#include "../jrd/os/path_utils.h"
#include "../jrd/misc_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@ -165,7 +166,7 @@ static const char * FB_PID_FILE = "fb_%d";
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#ifndef REQUESTER
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#endif
#ifdef WIN_NT
@ -496,6 +497,27 @@ static const UCHAR
#endif
// This function is very crude, but signal-safe.
void gds__ulstr(char* buffer, ULONG value, int maxlen, char filler) {
ULONG n = value;
int c = 0;
while (n) {
n = n/10;
c++;
}
if (maxlen > c)
c = maxlen;
char *p = buffer + c;
while (value) {
*--p = '0' + (value % 10);
value = value/10;
}
while (p != buffer) {
*--p = filler;
}
buffer[c] = 0;
}
ISC_STATUS API_ROUTINE gds__decode(ISC_STATUS code, USHORT* fac, USHORT* class_)
{
/**************************************
@ -1036,6 +1058,95 @@ void API_ROUTINE gds__interprete_a(
}
#define SECS_PER_HOUR (60 * 60)
#define SECS_PER_DAY (SECS_PER_HOUR * 24)
void API_ROUTINE gds__trace(const TEXT * text)
{
/**************************************
*
* g d s _ t r a c e
*
**************************************
*
* Functional description
* Post trace event to a log file.
* This function tries to be async-signal safe
*
**************************************/
TEXT name[MAXPATHLEN];
// This function is not truly signal safe now.
// It calls string::c_str() and may call getenv(), not good.
// We can only hope that failure is unlikely in it...
gds__prefix(name, LOGFILE);
time_t now = time((time_t *)0); // is specified in POSIX to be signal-safe
// 07 Sept 2003, Nickolay Samofatov.
// Since we cannot call ctime/localtime_r or anything else like this from
// signal hanlders we need to decode time by hand.
struct tm today;
int days, rem;
days = now / SECS_PER_DAY;
rem = now % SECS_PER_DAY;
today.tm_hour = rem / SECS_PER_HOUR;
rem %= SECS_PER_HOUR;
today.tm_min = rem / 60;
today.tm_sec = rem % 60;
ndate(days + 40617 /* Number of first day of the Epoch in GDS counting */,
&today);
char buffer[1024]; // 1K should be enough for the trace message
char *p = buffer;
gds__ulstr(p, today.tm_year+1900, 4, '0'); p+=4;
*p++ = '-';
gds__ulstr(p, today.tm_mon, 2, '0'); p+=2;
*p++ = '-';
gds__ulstr(p, today.tm_mday, 2, '0'); p+=2;
*p++ = 'T';
gds__ulstr(p, today.tm_hour, 2, '0'); p+=2;
*p++ = ':';
gds__ulstr(p, today.tm_min, 2, '0'); p+=2;
*p++ = ':';
gds__ulstr(p, today.tm_sec, 2, '0'); p+=2;
*p++ = ' ';
gds__ulstr(p,
#ifdef WIN_NT
#ifdef SUPERSERVER
GetCurrentThreadId(),
#else
GetCurrentProcessId(),
#endif
#else
getpid(),
#endif
5, ' '); p += 5;
*p++ = ' ';
strcpy(p, text); p += strlen(p);
strcat(p, "\n"); p += strlen(p);
#ifdef WIN_NT
// Signal-unsafe code
IB_FILE *file;
if ((file = ib_fopen(name, FOPEN_APPEND_TYPE)) != NULL)
{
ib_fwrite(buffer, 1, p - buffer, file);
ib_fclose(file);
}
#else
// Note: signal-safe code
int file = open(name, O_CREAT | O_APPEND | O_WRONLY, 0660);
if (file == -1) return;
write(file, buffer, p-buffer);
close(file);
#endif
}
void API_ROUTINE gds__log(const TEXT * text, ...)
{
/**************************************
@ -1074,8 +1185,8 @@ void API_ROUTINE gds__log(const TEXT * text, ...)
if ((file = ib_fopen(name, FOPEN_APPEND_TYPE)) != NULL)
{
ib_fprintf(file, "%s%s\t%.25s\t", ISC_get_host(name, MAXPATHLEN),
gdslogid, ctime(&now));
ib_fprintf(file, "\n%s%s\t%.25s\t",
ISC_get_host(name, MAXPATHLEN), gdslogid, ctime(&now));
VA_START(ptr, text);
ib_vfprintf(file, text, ptr);
ib_fprintf(file, "\n\n");

View File

@ -87,6 +87,7 @@ ULONG API_ROUTINE gds__free(void*);
SLONG API_ROUTINE gds__interprete(char*, ISC_STATUS**);
void API_ROUTINE gds__interprete_a(SCHAR*, SSHORT*, ISC_STATUS*, SSHORT*);
void API_ROUTINE gds__log(const TEXT*, ...);
void API_ROUTINE gds__trace(const TEXT*);
void API_ROUTINE gds__log_status(TEXT*, ISC_STATUS*);
int API_ROUTINE gds__msg_close(void*);
SSHORT API_ROUTINE gds__msg_format(void* handle,
@ -133,6 +134,7 @@ void API_ROUTINE isc_print_sqlerror(SSHORT, ISC_STATUS*);
void API_ROUTINE isc_sql_interprete(SSHORT, TEXT*, SSHORT);
SINT64 API_ROUTINE isc_portable_integer(UCHAR*, SSHORT);
void gds__cleanup(void);
extern void gds__ulstr(char* buffer, ULONG value, int maxlen, char filler);
#if (defined SOLARIS && !defined(MAP_ANON))

View File

@ -1,69 +0,0 @@
/*
* PROGRAM: JRD Access Method
* MODULE: isc_i_proto.h
* DESCRIPTION: Prototype header file for isc_ipc.c
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
#ifndef _JRD_ISC_I_PROTO_H_
#define _JRD_ISC_I_PROTO_H_
#ifdef __cplusplus
extern "C" {
#endif
void DLL_EXPORT ISC_enter(void);
void DLL_EXPORT ISC_exit(void);
#ifdef __cplusplus
}
#endif
void DLL_EXPORT ISC_enable(void);
void DLL_EXPORT ISC_inhibit(void);
#ifdef WIN_NT
int API_ROUTINE ISC_kill(SLONG, SLONG, void *);
#else
int ISC_kill(SLONG, SLONG);
#endif
/* Signal routines have FPTR_VOID parameters instead of SIG_FPTR to
hide OS signal implementation details for this module users.
SIG_FPTR is very platform dependent. C/C++ ignores redundant function
parameters anyway
*/
#if (defined __cplusplus) && (defined SOLX86)
/* Who else got mixed c and C++ linkage error - let join me. KLK
*/
extern "C" {
#endif
extern void API_ROUTINE ISC_signal(int, FPTR_VOID, void *);
extern void API_ROUTINE ISC_signal_cancel(int, FPTR_VOID, void *);
extern void DLL_EXPORT ISC_signal_init(void);
#if (defined __cplusplus) && (defined SOLX86)
/* Who else got mixed c and C++ linkage error - let join me. KLK
*/
}
#endif
#endif /* _JRD_ISC_I_PROTO_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ extern int ISC_event_init_shared(struct event *,
extern int DLL_EXPORT ISC_event_post(struct event *);
extern int DLL_EXPORT ISC_event_wait(SSHORT,
struct event **,
SLONG *, SLONG, FPTR_VOID, void *);
SLONG *, SLONG, FPTR_VOID_PTR, void *);
#ifdef WIN_NT
extern void *ISC_make_signal(BOOLEAN, BOOLEAN, int, int);
@ -89,8 +89,8 @@ extern ULONG ISC_exception_post(ULONG, TEXT *);
extern UCHAR *DLL_EXPORT ISC_remap_file(ISC_STATUS *,
struct sh_mem *, SLONG, USHORT);
extern void ISC_reset_timer(FPTR_VOID, void *, SLONG *, void **);
extern void ISC_set_timer(SLONG, FPTR_VOID, void *, SLONG *, void **);
extern void ISC_reset_timer(FPTR_VOID_PTR, void *, SLONG *, void **);
extern void ISC_set_timer(SLONG, FPTR_VOID_PTR, void *, SLONG *, void **);
extern void DLL_EXPORT ISC_unmap_file(ISC_STATUS *, struct sh_mem *, USHORT);

View File

@ -67,7 +67,7 @@
#include "../jrd/isc.h"
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/file_params.h"
#include "../jrd/gdsassert.h"
@ -187,7 +187,7 @@ static void error(ISC_STATUS *, TEXT *, ISC_STATUS);
static SLONG find_key(ISC_STATUS *, TEXT *);
#endif
#if defined(UNIX) && !defined(POSIX_THREADS) && !defined(SOLARIS_MT)
static void alarm_handler(void);
static void alarm_handler(void* arg);
static SLONG open_semaphores(ISC_STATUS *, SLONG, int&);
static SLONG create_semaphores(ISC_STATUS *, SLONG, int);
static BOOLEAN semaphore_wait_isc_sync(int, int, int *);
@ -454,7 +454,7 @@ int ISC_event_wait(SSHORT count,
EVENT* events,
SLONG* values,
SLONG micro_seconds,
FPTR_VOID timeout_handler,
FPTR_VOID_PTR timeout_handler,
void* handler_arg)
{
/**************************************
@ -722,7 +722,7 @@ int ISC_event_wait(
EVENT * events,
SLONG * values,
SLONG micro_seconds,
FPTR_VOID timeout_handler, void *handler_arg)
FPTR_VOID_PTR timeout_handler, void *handler_arg)
{
/**************************************
*
@ -964,7 +964,7 @@ int ISC_event_wait(
EVENT * events,
SLONG * values,
SLONG micro_seconds,
FPTR_VOID timeout_handler, void *handler_arg)
FPTR_VOID_PTR timeout_handler, void *handler_arg)
{
/**************************************
*
@ -986,17 +986,8 @@ int ISC_event_wait(
EVENT *event;
int semid, i;
int semnums[16], *semnum;
#ifdef SYSV_SIGNALS
SLONG user_timer;
void *user_handler;
#else
struct itimerval user_timer;
#ifndef HAVE_SIGACTION
struct sigvec user_handler;
#else
struct sigaction user_handler;
#endif
#endif
/* If we're not blocked, the rest is a gross waste of time */
@ -1170,7 +1161,7 @@ int ISC_event_wait(
EVENT * events,
SLONG * values,
SLONG micro_seconds,
void (*timeout_handler) (), void *handler_arg)
FPTR_VOID_PTR timeout_handler, void *handler_arg)
{
/**************************************
*
@ -1371,7 +1362,7 @@ int DLL_EXPORT ISC_event_wait(
EVENT * events,
SLONG * values,
SLONG micro_seconds,
void (*timeout_handler) (),
FPTR_VOID_PTR timeout_handler,
void *handler_arg)
{
/**************************************
@ -1499,7 +1490,8 @@ int DLL_EXPORT ISC_event_wait(
EVENT * events,
SLONG * values,
SLONG micro_seconds,
void (*timeout_handler) (), void *handler_arg)
FPTR_VOID_PTR timeout_handler,
void *handler_arg)
{
/**************************************
*
@ -3803,7 +3795,7 @@ UCHAR *DLL_EXPORT ISC_remap_file(ISC_STATUS * status_vector,
#if (defined UNIX)
void ISC_reset_timer(
FPTR_VOID timeout_handler,
FPTR_VOID_PTR timeout_handler,
void *timeout_arg,
SLONG * client_timer, void **client_handler)
{
@ -3818,29 +3810,17 @@ void ISC_reset_timer(
* the previous context.
*
**************************************/
#ifndef SYSV_SIGNALS
struct itimerval internal_timer;
#endif
ISC_signal_cancel(SIGALRM, timeout_handler, timeout_arg);
/* Cancel the timer, then restore the previous handler and alarm */
#ifdef SYSV_SIGNALS
alarm(0);
sigset(SIGALRM, *client_handler);
alarm(*client_timer);
#else
timerclear(&internal_timer.it_interval);
timerclear(&internal_timer.it_value);
setitimer(ITIMER_REAL, &internal_timer, NULL);
#ifndef HAVE_SIGACTION
sigvector(SIGALRM, client_handler, NULL);
#else
sigaction(SIGALRM, (struct sigaction*)client_handler, NULL);
#endif
setitimer(ITIMER_REAL, (itimerval*)client_timer, NULL);
#endif
}
#endif
@ -3848,7 +3828,7 @@ void ISC_reset_timer(
#if (defined UNIX)
void ISC_set_timer(
SLONG micro_seconds,
FPTR_VOID timeout_handler,
FPTR_VOID_PTR timeout_handler,
void *timeout_arg,
SLONG * client_timer, void **client_handler)
{
@ -3862,51 +3842,23 @@ void ISC_set_timer(
* Set a timer for the specified amount of time.
*
**************************************/
#ifdef SYSV_SIGNALS
void *d2;
SLONG d1;
#else
struct itimerval internal_timer;
#ifndef HAVE_SIGACTION
struct sigvec internal_handler;
#else
struct sigaction internal_handler;
#endif
#endif
/* Start by cancelling any existing timer */
#ifdef SYSV_SIGNALS
if (!client_timer)
client_timer = &d1;
*client_timer = alarm(0);
#else
timerclear(&internal_timer.it_interval);
timerclear(&internal_timer.it_value);
setitimer(ITIMER_REAL, &internal_timer,
(struct itimerval *) client_timer);
#endif
/* Now clear the signal handler while saving the existing one */
#ifdef SYSV_SIGNALS
if (!client_handler)
client_handler = &d2;
*client_handler = (void *) sigset(SIGALRM, SIG_DFL);
#else
#ifndef HAVE_SIGACTION
internal_handler.sv_handler = SIG_DFL;
internal_handler.sv_mask = 0;
internal_handler.sv_flags = SV_INTERRUPT;
sigvector(SIGALRM, &internal_handler, (struct sigvec *) client_handler);
#else
internal_handler.sa_handler = (SIG_FPTR) SIG_DFL;
memset(&internal_handler.sa_mask, 0, sizeof(internal_handler.sa_mask));
internal_handler.sa_handler = SIG_DFL;
sigemptyset(&internal_handler.sa_mask);
internal_handler.sa_flags = SA_RESTART;
sigaction(SIGALRM, &internal_handler,
(struct sigaction *) client_handler);
#endif
#endif
if (!micro_seconds)
return;
@ -3915,12 +3867,6 @@ void ISC_set_timer(
ISC_signal(SIGALRM, timeout_handler, timeout_arg);
#ifdef SYSV_SIGNALS
if (micro_seconds < 1000000)
alarm(1);
else
alarm(micro_seconds / 1000000);
#else
if (micro_seconds < 1000000)
internal_timer.it_value.tv_usec = micro_seconds;
else {
@ -3928,7 +3874,6 @@ void ISC_set_timer(
internal_timer.it_value.tv_usec = micro_seconds % 1000000;
}
setitimer(ITIMER_REAL, &internal_timer, NULL);
#endif
}
#endif
@ -4098,7 +4043,7 @@ void DLL_EXPORT ISC_unmap_file(
#if defined(UNIX) && !defined(POSIX_THREADS) && !defined(SOLARIS_MT)
static void alarm_handler(void)
static void alarm_handler(void* arg)
{
/**************************************
*

View File

@ -191,6 +191,13 @@ JMB: As part of the c++ conversion I removed the check for lck block type.
#define LCK_CHECK_LOCK(x) (TRUE) /* nothing */
#endif
void LCK_ast_inhibit() {
LOCK_ast_inhibit();
}
void LCK_ast_enable() {
LOCK_ast_enable();
}
void LCK_assert(TDBB tdbb, LCK lock)
{
@ -495,6 +502,7 @@ SLONG LCK_get_owner_handle(TDBB tdbb, enum lck_t lock_type)
case LCK_range_relation:
case LCK_backup_state:
case LCK_backup_alloc:
case LCK_backup_database:
return LCK_OWNER_HANDLE_DBB;
case LCK_attachment:
case LCK_relation:

View File

@ -44,8 +44,9 @@ enum lck_t {
LCK_prc_exist, /* Relation existence lock */
LCK_range_relation, /* Relation refresh range lock */
LCK_update_shadow, /* shadow update sync lock */
LCK_backup_state, /* Lock to synchronize for objects depending on backup status*/
LCK_backup_alloc /* Lock for page allocation table in backup spare file */
LCK_backup_state, /* Lock to synchronize for objects depending on backup status */
LCK_backup_alloc, /* Lock for page allocation table in backup spare file */
LCK_backup_database /* Lock to protect writing to database file */
};
/* Lock owner types */

View File

@ -46,6 +46,8 @@ extern SLONG LCK_read_data(struct lck *);
extern void LCK_release(TDBB, struct lck *);
extern void LCK_re_post(struct lck *);
extern void LCK_write_data(struct lck *, SLONG);
extern void LCK_ast_inhibit();
extern void LCK_ast_enable();
#ifdef __cplusplus
} /* extern "C" */

File diff suppressed because it is too large Load Diff

View File

@ -3,24 +3,37 @@
* MODULE: nbak.h
* DESCRIPTION: New backup interface definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: nbak.h,v 1.4 2003-09-08 20:23:35 skidder Exp $
*
*/
#ifndef _JRD_NBAK_H_
@ -30,6 +43,18 @@
#include "../common/classes/rwlock.h"
#include "../common/classes/alloc.h"
// Uncomment this line if you need to trace backup-related activity
//#define NBAK_DEBUG
#ifdef NBAK_DEBUG
DEFINE_TRACE_ROUTINE(nbak_trace);
#define NBAK_TRACE(args) nbak_trace args
#define NBAK_TRACE_AST(message) gds__trace(message)
#else
#define NBAK_TRACE(args) /* nothing */
#define NBAK_TRACE_AST(message) /* nothing */
#endif
class AllocItem {
public:
ULONG db_page; // Page number in the main database file
@ -54,7 +79,7 @@ public:
// Subsystem initialization
BackupManager(class dbb* _database, int ini_state);
// Release locks in response to shutdown AST
void shutdown_locks();
void shutdown_locks() throw();
// Subsystem finalization
~BackupManager();
// Set difference file name in header.
@ -62,20 +87,20 @@ public:
void set_difference(const char* filename);
// Prevent backup state from modification by others
// You may or may not call unlock_state in case this function fails
bool lock_state(bool thread_exit);
bool lock_state(bool thread_exit) throw();
// Remove our interest in consistent backup state
void unlock_state();
void unlock_state() throw();
// Return current backup state
int get_state() const {
int get_state() const throw() {
return backup_state;
}
// Return current SCN for database
ULONG get_current_scn() const {
ULONG get_current_scn() const throw() {
return current_scn;
}
// Return the amount of pages in locked database files
SLONG get_backup_pages() const {
SLONG get_backup_pages() const throw() {
return backup_pages;
}
@ -89,72 +114,99 @@ public:
// Prevent allocation table from modification by other threads/processes
// You may or may not call unlock function in case this functions fail
bool lock_alloc(bool thread_exit);
bool lock_alloc_write(bool thread_exit);
bool lock_alloc(bool thread_exit) throw();
bool lock_alloc_write(bool thread_exit) throw();
// Remove our interest in static allocation table
void unlock_alloc();
void unlock_alloc_write();
void unlock_alloc() throw();
void unlock_alloc_write() throw();
// Return page index in difference file that can be used in
// write_difference call later.
ULONG get_page_index(ULONG db_page) const;
ULONG get_page_index(ULONG db_page) const throw();
// Return next page index in the difference file to be allocated
ULONG get_next_page() const {
return last_allocated_page+1;
ULONG allocate_difference_page(ULONG db_page) throw();
// Must have ISC_STATUS because it is called from write_page
bool write_difference(ISC_STATUS* status, ULONG diff_page, struct pag* page) throw();
bool read_difference(ULONG diff_page, struct pag* page) throw();
// Routines to declare and release interest in the main database file
bool get_sw_database_lock(bool thread_exit, bool enable_signals) throw();
void release_sw_database_lock() throw();
#ifndef SUPERSERVER
// Routines to declare and release deferred interest in the difference file
void increment_diff_use_count() throw();
void decrement_diff_use_count() throw();
SLONG get_current_generation() const throw() {
return diff_generation;
}
// Mark next difference page as used by some database page
bool mark_alloc(ISC_STATUS* status, ULONG db_page);
bool write_difference(ISC_STATUS* status, ULONG diff_page, struct pag* page);
bool read_difference(ISC_STATUS* status, ULONG diff_page, struct pag* page);
bool actualize_state(ISC_STATUS* status);
// Ensure that cached allocation table contains the same information as database
// Return false in case of error
bool actualize_alloc(ISC_STATUS* status);
#endif
private:
class dbb* database;
class fil* diff_file;
AllocItemTree* alloc_table; // Cached allocation table of pages in difference file
int backup_state;
volatile SATOM backup_state;
ULONG last_allocated_page; // Last physical page allocated in the difference file
ULONG *alloc_buffer;
ULONG *alloc_buffer, *empty_buffer, *spare_buffer;
ULONG current_scn;
ULONG alloc_scn; // SCN of cached allocation table
SLONG backup_pages; // Number of allocated pages as it was at point of backup lock
char diff_name[MAXPATHLEN];
// Set if we need to close difference file in the next status update cycle
// Used in CS builds to prevent closing difference file too early while it still
// may be used inside the signal handlers
bool diff_pending_close;
#ifdef SUPERSERVER
Firebird::RWLock* alloc_lock; // Lock to protect allocation table
Firebird::RWLock* state_lock; // Lock to protect backup lock
Firebird::RWLock* database_lock; // Lock to protect write to database
// Lock to protect initialization of alloc_table and diff_file
// outside of exclusive status lock to prevent possible race condition
// in case of errors.
Firebird::Spinlock* adjust_state_lock;
#else
class lck* alloc_lock; // Lock to protect allocation table
class lck* state_lock; // Lock to protect backup lock
ULONG ast_flags;
static int backup_state_ast(void *ast_object);
static int alloc_table_ast(void *ast_object);
class lck* state_lock; // Lock to protect backup state
class lck* database_lock; // Lock to protect writing to database
// Absense of 'volatile' REALLY causes database corruption
// with optimized build on Linux CS. Do not remove it !
volatile UATOM flags;
// Variables used at AST level
volatile UATOM ast_flags;
volatile SATOM database_use_count;
volatile SATOM diff_use_count;
volatile SATOM diff_generation;
static int backup_state_ast(void *ast_object) throw();
static int alloc_table_ast(void *ast_object) throw();
static int backup_database_ast(void *ast_object) throw();
#endif
bool try_lock_state_write();
void lock_state_write(bool thread_exit);
void unlock_state_write();
void generate_filename();
void unlock_state_write() throw();
void generate_filename() throw();
// Make appropriate information up-to-date
bool actualize_state() throw();
bool actualize_alloc() throw();
};
/* Bit values for backup subsystem flags */
#define NBAK_state_blocking 1
#define NBAK_state_in_use 2
#define NBAK_alloc_blocking 4
#define NBAK_alloc_in_use 8
#define NBAK_alloc_dirty 16
// Flags manipulated normally
#define NBAK_state_in_use 1
#define NBAK_alloc_in_use 2
/* Node this flags MUST correspond with backup mask in ods.h */
#define nbak_state_normal 0x0 /* Normal mode. Changes are simply written to main files */
#define nbak_state_stalled 0x400 /* Main files are locked. Changes are written to diff file */
#define nbak_state_merge 0x800 /* Merging changes from diff file into main files */
#define nbak_state_unknown -1 /* State is unknown. Needs to be read from disk */
// Flags manipulated at AST level
#define NBAK_state_blocking 1
#define NBAK_alloc_blocking 2
#define NBAK_database_blocking 4
#define NBAK_alloc_dirty 8
// Note this flags MUST correspond with backup mask in ods.h
#define nbak_state_normal 0x0 // Normal mode. Changes are simply written to main files
#define nbak_state_stalled 0x400 // Main files are locked. Changes are written to diff file
#define nbak_state_merge 0x800 // Merging changes from diff file into main files
#define nbak_state_unknown -1 // State is unknown. Needs to be read from disk
#endif /* _JRD_NBAK_PROTO_H_ */

View File

@ -3,24 +3,37 @@
* MODULE: guid.h
* DESCRIPTION: Portable GUID definition
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: guid.h,v 1.3 2003-09-08 20:23:36 skidder Exp $
*
*/
#ifndef GUID_H

View File

@ -34,7 +34,8 @@
#include <stdio.h>
void GenerateGuid(FB_GUID *guid) {
int fd = open("/dev/random", O_RDONLY);
// do not use /dev/random because it may return lesser data than we need.
int fd = open("/dev/urandom", O_RDONLY);
if (fd < 0)
Firebird::system_call_failed::raise();
if (read(fd, guid, sizeof(FB_GUID)) != sizeof(FB_GUID))

View File

@ -0,0 +1,583 @@
/*
* PROGRAM: JRD Access Method
* MODULE: isc_ipc.c
* DESCRIPTION: Handing and posting of signals (POSIX)
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden
*
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
* - EPSON, DELTA, IMP, NCR3000 and M88K
*
* 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "UNIXWARE" port
*
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
*
* 2003.08.27 Nickolay Samofatov - create POSIX version of this module
*
*/
/* $Id: isc_ipc.cpp,v 1.1 2003-09-08 20:23:37 skidder Exp $ */
#include "firebird.h"
#include "../jrd/ib_stdio.h"
#include <stdlib.h>
#include <assert.h>
#include "../jrd/common.h"
#include "gen/codes.h"
#include "../jrd/isc.h"
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/thd_proto.h"
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#ifdef HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef O_RDWR
#include <fcntl.h>
#endif
#define LOCAL_SEMAPHORES 4
typedef struct sig {
struct sig *sig_next;
int sig_signal;
union {
FPTR_VOID_PTR user;
void (*client) (int, siginfo_t*, void*);
FPTR_INT_VOID_PTR informs;
FPTR_VOID untyped;
} sig_routine;
void *sig_arg;
USHORT sig_flags;
} *SIG;
#define SIG_user 0 /* Our routine */
#define SIG_client 1 /* Not our routine */
#define SIG_informs 2 /* routine tells us whether to chain */
#define SIG_informs_continue 0 /* continue on signal processing */
#define SIG_informs_stop 1 /* stop signal processing */
static USHORT initialized_signals = FALSE;
static SIG volatile signals = NULL;
static SLONG volatile overflow_count = 0;
#ifdef MULTI_THREAD
static MUTX_T sig_mutex;
#endif
static int process_id = 0;
#ifndef GDS_RELAY
#define GDS_RELAY "/bin/gds_relay"
#endif
static int volatile relay_pipe = 0;
static void cleanup(void *arg);
static void isc_signal2(int signal, FPTR_VOID handler, void *arg, ULONG);
static SLONG overflow_handler(void *arg);
static SIG que_signal(int signal, FPTR_VOID handler, void *arg, int flags);
static void CLIB_ROUTINE signal_handler(int number,
siginfo_t *info,
void *pointer);
#ifndef SIG_HOLD
#define SIG_HOLD SIG_DFL
#endif
// Not thread-safe
extern "C" {
ULONG isc_enter_count = 0;
}
void DLL_EXPORT ISC_enter(void)
{
/**************************************
*
* I S C _ e n t e r
*
**************************************
*
* Functional description
* Enter ISC world from caller.
*
**************************************/
/* Cancel our handler for SIGFPE - in case it was already there */
ISC_signal_cancel(SIGFPE, reinterpret_cast<FPTR_VOID_PTR>(overflow_handler), NULL);
/* Setup overflow handler - with chaining to any user handler */
isc_signal2(SIGFPE, reinterpret_cast<FPTR_VOID>(overflow_handler), NULL, SIG_informs);
#ifdef DEBUG_FPE_HANDLING
/* Debug code to simulate an FPE occuring during DB Operation */
if (overflow_count < 100)
(void) kill(getpid(), SIGFPE);
#endif
}
volatile sig_atomic_t inhibit_counter = 0;
sigset_t saved_sigmask;
void DLL_EXPORT ISC_inhibit() throw()
{
/**************************************
*
* I S C _ i n h i b i t
*
**************************************
*
* Functional description
* Inhibit process of signals. Signals will be
* retained until signals are eventually re-enabled,
* then re-posted.
*
**************************************/
if (inhibit_counter == 0) {
sigset_t set, oset;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &saved_sigmask);
}
inhibit_counter++;
}
void DLL_EXPORT ISC_enable() throw()
{
/**************************************
*
* I S C _ e n a b l e
*
**************************************
*
* Functional description
* Enable signal processing. Re-post any pending signals.
*
**************************************/
assert(inhibit_counter > 0);
inhibit_counter--;
if (inhibit_counter == 0) {
// Return to the mask as it were before the first recursive
// call to ISC_inhibit
sigprocmask(SIG_SETMASK, &saved_sigmask, NULL);
}
}
void DLL_EXPORT ISC_exit(void)
{
/**************************************
*
* I S C _ e x i t
*
**************************************
*
* Functional description
* Exit ISC world, return to caller.
*
**************************************/
/* No longer attempt to handle overflow internally */
ISC_signal_cancel(SIGFPE, reinterpret_cast<FPTR_VOID_PTR>(overflow_handler), 0);
}
#ifdef UNIX
int ISC_kill(SLONG pid, SLONG signal_number)
{
/**************************************
*
* I S C _ k i l l ( U N I X )
*
**************************************
*
* Functional description
* Notify somebody else.
*
**************************************/
SLONG msg[3];
int status, pipes[2];
TEXT process[MAXPATHLEN], arg[10];
for (;;) {
status = kill(pid, signal_number);
if (!status)
return status;
if (SYSCALL_INTERRUPTED(errno))
continue;
if (errno == EPERM)
break;
return status;
}
/* Process is there, but we don't have the privilege to
send to him. */
if (!relay_pipe) {
gds__prefix(process, GDS_RELAY);
if (pipe(pipes)) {
gds__log("ISC_kill: error %d creating gds_relay", errno);
return -1;
}
sprintf(arg, "%d", pipes[0]);
if (!vfork()) {
execl(process, process, arg, 0);
gds__log("ISC_kill: error %d starting gds_relay %s", errno,
process);
_exit(0);
}
relay_pipe = pipes[1];
/* Don't need the READ pipe */
close(pipes[0]);
}
msg[0] = pid;
msg[1] = signal_number;
msg[2] = msg[0] ^ msg[1]; /* XOR for a consistancy check */
if (write(relay_pipe, msg, sizeof(msg)) != sizeof(msg)) {
gds__log("ISC_kill: write to relay_pipe failed %d", errno);
relay_pipe = 0; /* try to restart next time */
return -1;
}
return 0;
}
#endif
void API_ROUTINE ISC_signal(int signal_number, FPTR_VOID_PTR handler, void *arg)
{
/**************************************
*
* I S C _ s i g n a l
*
**************************************
*
* Functional description
* Multiplex multiple handers into single signal.
*
**************************************/
isc_signal2(signal_number, reinterpret_cast<FPTR_VOID>(handler), arg, SIG_user);
}
static void isc_signal2(
int signal_number,
FPTR_VOID handler, void *arg, ULONG flags)
{
/**************************************
*
* i s c _ s i g n a l 2 ( u n i x , W I N _ N T , O S 2 )
*
**************************************
*
* Functional description
* Multiplex multiple handers into single signal.
*
**************************************/
SIG sig;
/* The signal handler needs the process id */
if (!process_id)
process_id = getpid();
THD_MUTEX_LOCK(&sig_mutex);
/* See if this signal has ever been cared about before */
for (sig = signals; sig; sig = sig->sig_next)
if (sig->sig_signal == signal_number)
break;
/* If it hasn't been attach our chain handler to the signal,
and queue up whatever used to handle it as a non-ISC
routine (they are invoked differently). Note that if
the old action was SIG_DFL, SIG_HOLD, SIG_IGN or our
multiplexor, there is no need to save it. */
if (!sig) {
struct sigaction act, oact;
act.sa_sigaction = signal_handler;
act.sa_flags = SA_RESTART | SA_SIGINFO;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, signal_number);
sigaction(signal_number, &act, &oact);
if ((oact.sa_flags & SA_SIGINFO &&
oact.sa_sigaction != signal_handler) ||
(!(oact.sa_flags & SA_SIGINFO) &&
oact.sa_handler != SIG_DFL &&
oact.sa_handler != SIG_HOLD &&
oact.sa_handler != SIG_IGN )
)
{
que_signal(signal_number,
(oact.sa_flags & SA_SIGINFO) ?
reinterpret_cast<FPTR_VOID>(oact.sa_sigaction) :
reinterpret_cast<FPTR_VOID>(oact.sa_handler),
NULL, SIG_client);
}
}
/* Que up the new ISC signal handler routine */
que_signal(signal_number, handler, arg, flags);
THD_MUTEX_UNLOCK(&sig_mutex);
}
void API_ROUTINE ISC_signal_cancel(
int signal_number,
FPTR_VOID_PTR handler, void *arg)
{
/**************************************
*
* I S C _ s i g n a l _ c a n c e l
*
**************************************
*
* Functional description
* Cancel a signal handler.
* If handler == NULL, cancel all handlers for a given signal.
*
**************************************/
SIG sig;
volatile SIG *ptr;
THD_MUTEX_LOCK(&sig_mutex);
for (ptr = &signals; sig = *ptr;) {
if (sig->sig_signal == signal_number &&
(handler == NULL ||
(sig->sig_routine.user == handler && sig->sig_arg == arg)))
{
*ptr = sig->sig_next;
gds__free(sig);
}
else
ptr = &(*ptr)->sig_next;
}
THD_MUTEX_UNLOCK(&sig_mutex);
}
void DLL_EXPORT ISC_signal_init(void)
{
/**************************************
*
* I S C _ s i g n a l _ i n i t
*
**************************************
*
* Functional description
* Initialize any system signal handlers.
*
**************************************/
if (initialized_signals)
return;
initialized_signals = TRUE;
overflow_count = 0;
gds__register_cleanup(cleanup, 0);
process_id = getpid();
THD_MUTEX_INIT(&sig_mutex);
isc_signal2(SIGFPE, reinterpret_cast<FPTR_VOID>(overflow_handler), 0, SIG_informs);
}
static void cleanup(void *arg)
{
/**************************************
*
* c l e a n u p
*
**************************************
*
* Functional description
* Module level cleanup handler.
*
**************************************/
signals = NULL;
THD_MUTEX_DESTROY(&sig_mutex);
process_id = 0;
initialized_signals = FALSE;
}
static SLONG overflow_handler(void *arg)
{
/**************************************
*
* o v e r f l o w _ h a n d l e r
*
**************************************
*
* Functional description
* Somebody overflowed. Ho hum.
*
**************************************/
#ifdef DEBUG_FPE_HANDLING
ib_fprintf(ib_stderr, "overflow_handler (%x)\n", arg);
#endif
/* If we're within ISC world (inside why-value) when the FPE occurs
* we handle it (basically by ignoring it). If it occurs outside of
* ISC world, return back a code that tells signal_handler to call any
* customer provided handler.
*/
if (isc_enter_count) {
++overflow_count;
#ifdef DEBUG_FPE_HANDLING
ib_fprintf(ib_stderr, "SIGFPE in isc code ignored %d\n",
overflow_count);
#endif
/* We've "handled" the FPE - let signal_handler know not to chain
the signal to other handlers */
return SIG_informs_stop;
}
else {
/* We've NOT "handled" the FPE - let signal_handler know to chain
the signal to other handlers */
return SIG_informs_continue;
}
}
static SIG que_signal(
int signal_number,
FPTR_VOID handler, void *arg, int flags)
{
/**************************************
*
* q u e _ s i g n a l
*
**************************************
*
* Functional description
* Que signal for later action.
*
**************************************/
SIG sig;
IPTR thread_id = 0;
sig = (SIG) gds__alloc((SLONG) sizeof(struct sig));
/* FREE: unknown */
if (!sig) { /* NOMEM: */
DEV_REPORT("que_signal: out of memory");
return NULL; /* NOMEM: not handled, too difficult */
}
#ifdef DEBUG_GDS_ALLOC
/* This will only be freed when a signal handler is de-registered
* and we don't do that at process exit - so this not always
* a freed structure.
*/
gds_alloc_flag_unfreed((void *) sig);
#endif
sig->sig_signal = signal_number;
sig->sig_routine.untyped = handler;
sig->sig_arg = arg;
sig->sig_flags = flags;
sig->sig_next = signals;
signals = sig;
return sig;
}
static void CLIB_ROUTINE signal_handler(int number,
siginfo_t *info,
void *pointer)
{
/**************************************
*
* s i g n a l _ h a n d l e r ( G E N E R I C )
*
**************************************
*
* Functional description
* Checkin with various signal handlers.
*
**************************************/
/* Invoke everybody who may have expressed an interest. */
for (SIG sig = signals; sig; sig = sig->sig_next)
if (sig->sig_signal == number)
if (sig->sig_flags & SIG_client)
(*sig->sig_routine.client)(number, info, pointer);
else if (sig->sig_flags & SIG_informs) {
/* Routine will tell us whether to chain the signal to other handlers */
if ((*sig->sig_routine.informs)(sig->sig_arg) == SIG_informs_stop)
break;
}
else
(*sig->sig_routine.user) (sig->sig_arg);
}

View File

@ -65,7 +65,7 @@
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#include "../jrd/isc_f_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/lck_proto.h"
#include "../jrd/mov_proto.h"

View File

@ -3,24 +3,37 @@
* MODULE: guid.h
* DESCRIPTION: Portable GUID (win32)
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: guid.cpp,v 1.3 2003-09-08 20:23:38 skidder Exp $
*
*/
#include <windows.h>

View File

@ -0,0 +1,302 @@
/*
* PROGRAM: JRD Access Method
* MODULE: isc_ipc.c
* DESCRIPTION: Handing and posting of signals (Windows)
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden
*
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
* - EPSON, DELTA, IMP, NCR3000 and M88K
*
* 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "UNIXWARE" port
*
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
*
* 2002.08.27 Nickolay Samofatov - create Windows version of this module
*
*/
/* $Id: isc_ipc.cpp,v 1.1 2003-09-08 20:23:38 skidder Exp $ */
#include <process.h>
#include <signal.h>
#include "firebird.h"
#include "../jrd/ib_stdio.h"
#include <stdlib.h>
#include "../jrd/common.h"
#include "gen/codes.h"
#include "../jrd/isc.h"
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/thd_proto.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifndef REQUESTER
static USHORT initialized_signals = FALSE;
static SLONG volatile overflow_count = 0;
static MUTX_T sig_mutex;
static int process_id = 0;
#endif /* of ifndef REQUESTER */
#define MAX_OPN_EVENTS 40
typedef struct opn_event {
SLONG opn_event_pid;
SLONG opn_event_signal; /* pseudo-signal number */
HANDLE opn_event_lhandle; /* local handle to foreign event */
ULONG opn_event_age;
} *OPN_EVENT;
static struct opn_event opn_events[MAX_OPN_EVENTS];
static USHORT opn_event_count;
static ULONG opn_event_clock;
static void (*system_overflow_handler)(int, int);
static SLONG overflow_handler(int, int) throw();
// Not thread-safe
extern "C" {
ULONG isc_enter_count = 0;
}
void DLL_EXPORT ISC_enter(void)
{
/**************************************
*
* I S C _ e n t e r
*
**************************************
*
* Functional description
* Enter ISC world from caller.
*
**************************************/
/* Setup overflow handler - with chaining to any user handler */
void (*temp)(int, int) = signal(SIGFPE, overflow_handler);
if (temp != overflow_handler)
system_overflow_handler = temp;
#ifdef DEBUG_FPE_HANDLING
/* Debug code to simulate an FPE occuring during DB Operation */
if (overflow_count < 100)
(void) kill(getpid(), SIGFPE);
#endif
}
void DLL_EXPORT ISC_exit(void)
{
/**************************************
*
* I S C _ e x i t
*
**************************************
*
* Functional description
* Exit ISC world, return to caller.
*
**************************************/
/* No longer attempt to handle overflow internally */
signal(SIGFPE, system_overflow_handler);
}
int API_ROUTINE ISC_kill(SLONG pid, SLONG signal_number, void *object_hndl)
{
/**************************************
*
* I S C _ k i l l ( W I N _ N T )
*
**************************************
*
* Functional description
* Notify somebody else.
*
**************************************/
ULONG oldest_age;
OPN_EVENT opn_event, end_opn_event, oldest_opn_event;
/* If we're simply trying to poke ourselves, do so directly. */
if (!process_id)
process_id = GetCurrentProcessId();
if (pid == process_id) {
SetEvent(object_hndl);
return 0;
}
oldest_age = ~0;
opn_event = opn_events;
end_opn_event = opn_event + opn_event_count;
for (; opn_event < end_opn_event; opn_event++) {
if (opn_event->opn_event_pid == pid &&
opn_event->opn_event_signal == signal_number) break;
if (opn_event->opn_event_age < oldest_age) {
oldest_opn_event = opn_event;
oldest_age = opn_event->opn_event_age;
}
}
if (opn_event >= end_opn_event) {
HANDLE lhandle;
if (!(lhandle = ISC_make_signal(FALSE, FALSE, pid, signal_number)))
return -1;
if (opn_event_count < MAX_OPN_EVENTS)
opn_event_count++;
else {
opn_event = oldest_opn_event;
CloseHandle(opn_event->opn_event_lhandle);
}
opn_event->opn_event_pid = pid;
opn_event->opn_event_signal = signal_number;
opn_event->opn_event_lhandle = lhandle;
}
opn_event->opn_event_age = ++opn_event_clock;
return (SetEvent(opn_event->opn_event_lhandle)) ? 0 : -1;
}
void DLL_EXPORT ISC_signal_init(void)
{
/**************************************
*
* I S C _ s i g n a l _ i n i t
*
**************************************
*
* Functional description
* Initialize any system signal handlers.
*
**************************************/
#ifndef REQUESTER
if (initialized_signals)
return;
initialized_signals = TRUE;
overflow_count = 0;
gds__register_cleanup(cleanup, 0);
process_id = getpid();
THD_MUTEX_INIT(&sig_mutex);
system_overflow_handler = signal(SIGFPE, overflow_handler);
#endif /* REQUESTER */
ISC_get_security_desc();
}
#ifndef REQUESTER
static void cleanup(void *arg)
{
/**************************************
*
* c l e a n u p
*
**************************************
*
* Functional description
* Module level cleanup handler.
*
**************************************/
signals = NULL;
THD_MUTEX_DESTROY(&sig_mutex);
pending_signals = 0;
process_id = 0;
OPN_EVENT opn_event;
opn_event = opn_events + opn_event_count;
opn_event_count = 0;
while (opn_event-- > opn_events)
CloseHandle(opn_event->opn_event_lhandle);
initialized_signals = FALSE;
}
#endif
#ifndef REQUESTER
static void overflow_handler(int signal, int code)
{
/**************************************
*
* o v e r f l o w _ h a n d l e r
*
**************************************
*
* Functional description
* Somebody overflowed. Ho hum.
*
**************************************/
#ifdef DEBUG_FPE_HANDLING
ib_fprintf(ib_stderr, "overflow_handler (%x)\n", arg);
#endif
/* If we're within ISC world (inside why-value) when the FPE occurs
* we handle it (basically by ignoring it). If it occurs outside of
* ISC world, return back a code that tells signal_handler to call any
* customer provided handler.
*/
if (isc_enter_count) {
++overflow_count;
#ifdef DEBUG_FPE_HANDLING
ib_fprintf(ib_stderr, "SIGFPE in isc code ignored %d\n",
overflow_count);
#endif
/* We've "handled" the FPE */
}
else {
/* We've NOT "handled" the FPE - let's chain
the signal to other handlers */
if (system_overflow_handler != SIG_DFL &&
system_overflow_handler != SIG_IGN &&
system_overflow_handler != SIG_HOLD)
{
system_overflow_handler(signal, code);
}
}
}
#endif

View File

@ -206,7 +206,7 @@ static void service_fork(TEXT *, SVC);
static void service_get(SVC, SCHAR *, USHORT, USHORT, USHORT, USHORT *);
static void service_put(SVC, SCHAR *, USHORT);
#if !defined(WIN_NT) && !defined(SUPERSERVER)
static void timeout_handler(SVC);
static void timeout_handler(void *service);
#endif
#if defined(WIN_NT) && !defined(SUPERSERVER)
static USHORT service_read(SVC, SCHAR *, USHORT, USHORT);
@ -3116,17 +3116,8 @@ static void service_get(
* that we have checked out of the scheduler.
*
**************************************/
#ifdef SYSV_SIGNALS
SLONG sv_timr;
void *sv_hndlr;
#else
struct itimerval sv_timr;
#ifndef HAVE_SIGACTION
struct sigvec sv_hndlr;
#else
struct sigaction sv_hndlr;
#endif
#endif
int c;
//USHORT timed_out;
SCHAR *buf;
@ -3140,7 +3131,7 @@ static void service_get(
buf = buffer;
if (timeout) {
ISC_set_timer((SLONG) (timeout * 100000), (void(*)())timeout_handler, service,
ISC_set_timer((SLONG) (timeout * 100000), timeout_handler, service,
(SLONG*)&sv_timr, (void**)&sv_hndlr);
iter = timeout * 10;
}
@ -3165,7 +3156,7 @@ static void service_get(
else {
errno_save = errno;
if (timeout)
ISC_reset_timer((void(*)())timeout_handler, service, (SLONG*)&sv_timr,
ISC_reset_timer(timeout_handler, service, (SLONG*)&sv_timr,
(void**)&sv_hndlr);
io_error("ib_getc", errno_save, "service pipe", isc_io_read_err,
TRUE);
@ -3173,7 +3164,7 @@ static void service_get(
}
if (timeout) {
ISC_reset_timer((void(*)())timeout_handler, service, (SLONG*)&sv_timr, (void**)&sv_hndlr);
ISC_reset_timer(timeout_handler, service, (SLONG*)&sv_timr, (void**)&sv_hndlr);
if (!iter)
service->svc_flags |= SVC_timeout;
}
@ -3215,7 +3206,7 @@ static void service_put(SVC service, SCHAR * buffer, USHORT length)
}
static void timeout_handler(SVC service)
static void timeout_handler(void *service)
{
/**************************************
*

View File

@ -26,7 +26,7 @@
*
*/
/*
$Id: thd.h,v 1.13 2003-08-10 15:43:22 skidder Exp $
$Id: thd.h,v 1.14 2003-09-08 20:23:35 skidder Exp $
*/
#ifndef _JRD_THD_H_
@ -137,8 +137,6 @@ struct IB_RTL_CRITICAL_SECTION
#endif
#ifdef MULTI_THREAD
#define SIGNAL_INHIBIT
#define SIGNAL_ENABLE
#ifdef SUPERSERVER
#define THREAD_ENTER SCH_enter()
#define THREAD_EXIT SCH_exit()
@ -163,11 +161,6 @@ struct IB_RTL_CRITICAL_SECTION
#define THREAD_YIELD
#endif
#ifndef SIGNAL_INHIBIT
#define SIGNAL_INHIBIT ISC_inhibit()
#define SIGNAL_ENABLE ISC_enable()
#endif
/* Thread priorities (may be ignored) */
#define THREAD_high 1

View File

@ -42,7 +42,7 @@
*
*/
/*
$Id: why.cpp,v 1.25 2003-09-08 14:09:34 dimitr Exp $
$Id: why.cpp,v 1.26 2003-09-08 20:23:35 skidder Exp $
*/
#include "firebird.h"
@ -76,7 +76,7 @@ $Id: why.cpp,v 1.25 2003-09-08 14:09:34 dimitr Exp $
#include "../jrd/isc_proto.h"
#include "../jrd/isc_f_proto.h"
#ifndef REQUESTER
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/sch_proto.h"
#endif

View File

@ -39,7 +39,7 @@
*/
/*
$Id: lock.cpp,v 1.69 2003-09-07 00:53:59 brodsom Exp $
$Id: lock.cpp,v 1.70 2003-09-08 20:23:39 skidder Exp $
*/
#include "firebird.h"
@ -54,7 +54,7 @@ $Id: lock.cpp,v 1.69 2003-09-07 00:53:59 brodsom Exp $
#include "../jrd/gds_proto.h"
#include "../jrd/gdsassert.h"
#include "../jrd/isc_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/sch_proto.h"
#include "../jrd/thd_proto.h"
@ -202,7 +202,7 @@ static USHORT alloc_semaphore(OWN, ISC_STATUS *);
#ifndef SUPERSERVER
// This is either signal handler of called from blocking_thread
// only SuperServer does direct calls to blocking_action2
static void blocking_action(PTR);
static void blocking_action(void *_owner_offset);
#endif
static void blocking_action2(PTR, PTR);
#ifdef USE_BLOCKING_THREAD
@ -236,7 +236,7 @@ static PTR grant_or_que(LRQ, LBL, SSHORT);
static ISC_STATUS init_lock_table(ISC_STATUS *);
static void init_owner_block(OWN, UCHAR, ULONG, USHORT);
#ifdef USE_WAKEUP_EVENTS
static void lock_alarm_handler(EVENT);
static void lock_alarm_handler(void *event);
#endif
static void lock_initialize(void *, SH_MEM, int);
static void insert_data_que(LBL);
@ -371,6 +371,21 @@ static const UCHAR compatibility[] = {
#define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2]
void LOCK_ast_inhibit() {
#ifdef MULTI_THREAD
AST_DISABLE;
#else
ISC_inhibit();
#endif
}
void LOCK_ast_enable() {
#ifdef MULTI_THREAD
AST_ENABLE;
#else
ISC_enable();
#endif
}
int LOCK_convert(PTR request_offset,
UCHAR type,
@ -752,8 +767,7 @@ void LOCK_fini( ISC_STATUS * status_vector, PTR * owner_offset)
release_mutex();
#ifdef USE_BLOCKING_SIGNALS
ISC_signal_cancel(LOCK_block_signal, ( void (*)()) blocking_action,
(void *) offset);
ISC_signal_cancel(LOCK_block_signal, blocking_action, (void *)offset);
#endif
*owner_offset = (PTR)0;
@ -816,7 +830,7 @@ int LOCK_init(
#ifdef USE_BLOCKING_SIGNALS
if (LOCK_owner_offset)
ISC_signal(LOCK_block_signal, (void(*)()) blocking_action,
ISC_signal(LOCK_block_signal, blocking_action,
(void *) LOCK_owner_offset);
#endif
@ -1002,7 +1016,7 @@ void LOCK_manager( PTR manager_owner_offset)
by setting an alarm clock. */
ret = ISC_event_wait(1, &event_ptr, &value,
LOCKMANTIMEOUT * 1000000, (FPTR_VOID) lock_alarm_handler,
LOCKMANTIMEOUT * 1000000, lock_alarm_handler,
event_ptr);
#ifdef DEBUG
@ -1559,7 +1573,7 @@ static void acquire( PTR owner_offset)
release_mutex();
ret = ISC_event_wait(1, &event_ptr, &value,
LOCK_solaris_stall * 1000000,
(void(*)()) lock_alarm_handler, event_ptr);
lock_alarm_handler, event_ptr);
#ifdef DEV_BUILD
if (ret != FB_SUCCESS)
gds__log
@ -1747,7 +1761,7 @@ static USHORT alloc_semaphore( OWN owner, ISC_STATUS * status_vector)
#ifndef SUPERSERVER
static void blocking_action( PTR owner_offset)
static void blocking_action( void* _owner_offset)
{
/**************************************
*
@ -1771,6 +1785,7 @@ static void blocking_action( PTR owner_offset)
* been done.
*
**************************************/
PTR owner_offset = (PTR)(U_IPTR)_owner_offset;
/* Ignore signals that occur when executing in lock manager
or when there is no owner block set up */
@ -3195,7 +3210,7 @@ static void init_owner_block(
#ifdef USE_WAKEUP_EVENTS
static void lock_alarm_handler( EVENT event)
static void lock_alarm_handler(void* event)
{
/**************************************
*
@ -3213,7 +3228,7 @@ static void lock_alarm_handler( EVENT event)
*
**************************************/
ISC_event_post(event);
ISC_event_post(reinterpret_cast<EVENT>(event));
}
#endif
@ -5034,7 +5049,7 @@ static USHORT wait_for_request(
AST_ENABLE;
ret = ISC_event_wait(1, &event_ptr, &value,
(timeout - current_time) * 1000000,
(void(*)())lock_alarm_handler, event_ptr);
lock_alarm_handler, event_ptr);
AST_DISABLE;
#ifdef SUPERSERVER
THREAD_ENTER;

View File

@ -40,5 +40,7 @@ SLONG LOCK_read_data2(SLONG, USHORT, UCHAR *, USHORT, SLONG);
void LOCK_re_post(int (*)(void *), void *, SLONG);
bool LOCK_shut_manager(void);
SLONG LOCK_write_data(SLONG, SLONG);
void LOCK_ast_inhibit();
void LOCK_ast_enable();
#endif /* _LOCK_LOCK_PROTO_H_ */

View File

@ -110,7 +110,7 @@ static const UCHAR compatibility[] = {
void CLIB_ROUTINE main( int argc, char *argv[])
int CLIB_ROUTINE main( int argc, char *argv[])
{
/**************************************
*

View File

@ -41,7 +41,7 @@
*
*/
/*
$Id: inet.cpp,v 1.72 2003-08-28 12:56:15 brodsom Exp $
$Id: inet.cpp,v 1.73 2003-09-08 20:23:41 skidder Exp $
*/
#include "firebird.h"
#include "../jrd/ib_stdio.h"
@ -113,7 +113,7 @@ extern "C" int innetgr(const char *, const char *, const char *, const char *);
#include "../jrd/gds_proto.h"
#include "../jrd/isc_proto.h"
#ifndef REQUESTER
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/sch_proto.h"
#endif /* REQUESTER */
@ -367,7 +367,7 @@ static bool_t inet_getbytes(XDR *, SCHAR *, u_int);
static bool_t inet_getlong(XDR *, SLONG *);
static u_int inet_getpostn(XDR *);
#if !(defined WIN_NT)
static void inet_handler(PORT);
static void inet_handler(void* _port);
#endif
static caddr_t inet_inline(XDR *, u_int);
static int inet_error(PORT, const TEXT *, ISC_STATUS, int);
@ -1655,7 +1655,7 @@ static PORT aux_connect(PORT port, PACKET* packet, XDR_INT (*ast)(void))
}
new_port->port_ast = ast;
ISC_signal(SIGURG, (FPTR_VOID)inet_handler, new_port);
ISC_signal(SIGURG, inet_handler, new_port);
}
#endif /* SIOCSPGRP */
@ -1959,7 +1959,7 @@ static void disconnect( PORT port)
#if !(defined VMS || defined WIN_NT)
if (port->port_ast) {
ISC_signal_cancel(SIGURG, (FPTR_VOID) inet_handler, port);
ISC_signal_cancel(SIGURG, inet_handler, port);
}
#endif
@ -3087,7 +3087,7 @@ static u_int inet_getpostn( XDR * xdrs)
}
#if !(defined WIN_NT)
static void inet_handler( PORT port)
static void inet_handler(void *_port)
{
/**************************************
*
@ -3103,6 +3103,7 @@ static void inet_handler( PORT port)
* handler to do something appropriate.
*
**************************************/
PORT port = reinterpret_cast<PORT>(_port);
int n;
SCHAR junk;
@ -3736,11 +3737,7 @@ static bool_t packet_send( PORT port, SCHAR * buffer, SSHORT buffer_length)
#ifdef HAVE_SETITIMER
struct itimerval internal_timer, client_timer;
#ifdef HAVE_SIGACTION
struct sigaction internal_handler, client_handler;
#else
struct sigvec internal_handler, client_handler;
#endif
#endif /* HAVE_SETITIMER */
data = buffer;
@ -3808,18 +3805,10 @@ static bool_t packet_send( PORT port, SCHAR * buffer, SSHORT buffer_length)
internal_timer.it_value.tv_sec = 0;
internal_timer.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &internal_timer, &client_timer);
#ifndef HAVE_SIGACTION
internal_handler.sv_handler = alarm_handler;
internal_handler.sv_mask = 0;
internal_handler.sv_flags = SV_INTERRUPT;
sigvector(SIGALRM, &internal_handler, &client_handler);
#else
internal_handler.sa_handler = (SIG_FPTR)alarm_handler;
memset(&internal_handler.sa_mask, 0,
sizeof(internal_handler.sa_mask));
internal_handler.sa_handler = alarm_handler;
sigemptyset(&internal_handler.sa_mask);
internal_handler.sa_flags = SA_RESTART;
sigaction(SIGALRM, &internal_handler, &client_handler);
#endif
}
internal_timer.it_value.tv_sec = 0;
@ -3835,11 +3824,7 @@ static bool_t packet_send( PORT port, SCHAR * buffer, SSHORT buffer_length)
internal_timer.it_value.tv_sec = 0;
internal_timer.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &internal_timer, NULL);
#ifdef HAVE_SIGACTION
sigaction(SIGALRM, &client_handler, NULL);
#else
sigvector(SIGALRM, &client_handler, NULL);
#endif
setitimer(ITIMER_REAL, &client_timer, NULL);
}
#endif /* HAVE_SETITIMER */

View File

@ -32,7 +32,7 @@
*
*/
/*
$Id: inet_server.cpp,v 1.27 2003-08-10 01:22:12 brodsom Exp $
$Id: inet_server.cpp,v 1.28 2003-09-08 20:23:41 skidder Exp $
*/
#include "firebird.h"
#include "../jrd/ib_stdio.h"
@ -154,11 +154,11 @@ extern "C" {
static int assign(SCHAR *);
#endif
//static void name_process(UCHAR *);
static void signal_handler(void);
static void signal_handler(int);
#ifdef SUPERSERVER
static void signal_sigpipe_handler(void);
static void signal_sigpipe_handler(int);
#endif
static void set_signal(int, FPTR_VOID);
static void set_signal(int, void (*)(int));
#ifdef WINDOWS_ROUTER
static int atov(UCHAR *, UCHAR **, SSHORT);
@ -195,6 +195,14 @@ int CLIB_ROUTINE main( int argc, char **argv)
fd_set mask;
#endif
// 01 Sept 2003, Nickolay Samofatov
// In GCC version 3.1-3.3 we need to install special error handler
// in order to get meaningful terminate() error message on stderr.
// In GCC 3.4 or later this is the default.
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
#endif
#ifdef WINDOWS_ROUTER
/*
* Construct an argc, argv so we can use the old parse code.
@ -340,7 +348,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
}
gds__log("INET_SERVER/main: gds_inet_server restarted");
}
set_signal(SIGUSR1, (void(*)()) SIG_DFL);
set_signal(SIGUSR1, SIG_DFL);
}
#endif
@ -559,7 +567,7 @@ static int assign( SCHAR * string)
#if !(defined VMS)
static void set_signal( int signal_number, void (*handler) (void))
static void set_signal( int signal_number, void (*handler) (int))
{
/**************************************
*
@ -571,33 +579,17 @@ static void set_signal( int signal_number, void (*handler) (void))
* Establish signal handler.
*
**************************************/
#ifdef SYSV_SIGNALS
sigset(signal_number, handler);
#else
#ifndef HAVE_SIGACTION
struct sigvec vec;
struct sigvec old_vec;
vec.sv_handler = handler;
vec.sv_mask = 0;
vec.sv_flags = SV_INTERRUPT;
sigvector(signal_number, &vec, &old_vec);
#else
struct sigaction vec, old_vec;
vec.sa_handler = (SIG_FPTR) handler;
memset(&vec.sa_mask, 0, sizeof(vec.sa_mask));
vec.sa_handler = handler;
sigemptyset(&vec.sa_mask);
vec.sa_flags = 0;
sigaction(signal_number, &vec, &old_vec);
#endif
#endif
}
#endif
static void signal_handler(void)
static void signal_handler(int)
{
/**************************************
*
@ -614,7 +606,7 @@ static void signal_handler(void)
}
#if (defined SUPERSERVER && defined UNIX )
static void signal_sigpipe_handler(void)
static void signal_sigpipe_handler(int)
{
/****************************************************
*

View File

@ -104,7 +104,7 @@
#include "../jrd/isc_proto.h"
#include "../jrd/thd_proto.h"
#include "../jrd/jrd_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/file_params.h"
#include "../common/config/config.h"

View File

@ -56,7 +56,7 @@
#include "gen/codes.h"
#endif
#ifdef SUPERSERVER
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#endif
#include "../remote/proto_proto.h" // xdr_protocol_overhead()

View File

@ -31,6 +31,8 @@
#include "../jrd/jrd_time.h"
#include "../jrd/gds.h"
#include "../jrd/ods.h"
#include "../jrd/os/guid.h"
#include "../jrd/nbak.h"
#include "../jrd/gds_proto.h"
static const TEXT months[][4] = {
@ -181,6 +183,17 @@ void PPG_print_header( HDR header, SLONG page,
FPRINTF(outfile, ", ");
FPRINTF(outfile, "read only");
}
if (flags & hdr_backup_mask) {
if (flag_count++)
FPRINTF(outfile, ", ");
if ((flags & hdr_backup_mask) == nbak_state_stalled)
FPRINTF(outfile, "backup lock");
else
if ((flags & hdr_backup_mask) == nbak_state_merge)
FPRINTF(outfile, "backup merge");
else
FPRINTF(outfile, "wrong backup state %d", flags & hdr_backup_mask);
}
FPRINTF(outfile, "\n");
}
@ -229,9 +242,24 @@ void PPG_print_header( HDR header, SLONG page,
break;
case HDR_cache_file:
FPRINTF(outfile, "\tShared Cache file:\t\t%s\n", p + 2);
memcpy(temp, p + 2, p[1]);
temp[p[1]] = '\0';
FPRINTF(outfile, "\tShared Cache file:\t\t%s\n", temp);
break;
case HDR_difference_file:
memcpy(temp, p + 2, p[1]);
temp[p[1]] = '\0';
FPRINTF(outfile, "\tBackup difference file:\t%s\n", temp);
break;
case HDR_backup_guid: {
char buff[GUID_BUFF_SIZE];
GuidToString(buff, reinterpret_cast<FB_GUID*>(p+2));
FPRINTF(outfile, "\tDatabase backup GUID:\t%s\n", buff);
break;
}
default:
if (*p > HDR_max)
FPRINTF(outfile, "\tUnrecognized option %d, length %d\n",

View File

@ -3,24 +3,37 @@
* MODULE: nbackup.cpp
* DESCRIPTION: Command line utility for physical backup/restore
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the Licence at
* http://www.gnu.org/licences/lgpl.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
* As a special exception this file can also be included in modules
* with other source code as long as that source code has been
* released under an Open Source Initiative certificed licence.
* More information about OSI certification can be found at:
* http://www.opensource.org
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
* This module 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 Lesser General Public Licence for more details.
*
* This module was created by members of the firebird development
* team. All individual contributions remain the Copyright (C) of
* those individuals and all rights are reserved. Contributors to
* this file are either listed below or can be obtained from a CVS
* history command.
*
* Created by: Nickolay Samofatov <skidder@bssys.com>
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Contributor(s):
*
*
* $Id: nbackup.cpp,v 1.6 2003-09-08 20:23:43 skidder Exp $
*
*/
@ -38,6 +51,7 @@
#include "../jrd/os/path_utils.h"
#include "../jrd/os/guid.h"
#include "../jrd/ibase.h"
#include <typeinfo>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@ -100,6 +114,7 @@ public:
#else
vsprintf(temp, message, params);
#endif
fprintf(stderr, "Failure: %s\n", temp);
va_end(params);
throw b_error(temp);
}
@ -390,6 +405,10 @@ void nbackup::attach_database() {
}
void nbackup::detach_database() {
if (trans) {
if (isc_rollback_transaction(status, &trans))
pr_error(status, "rollback transaction");
}
if (isc_detach_database(status, &newdb))
pr_error(status, "detach database");
}
@ -418,7 +437,10 @@ void nbackup::lock_database() {
attach_database();
try {
internal_lock_database();
} catch(const std::exception&) {
} catch(const std::exception& ex) {
if (typeid(ex) != typeid(b_error)) {
fprintf(stderr, "Unexpected error %s: %s\n", typeid(ex).name(), ex.what());
}
detach_database();
throw;
}
@ -429,7 +451,10 @@ void nbackup::unlock_database() {
attach_database();
try {
internal_unlock_database();
} catch(const std::exception&) {
} catch(const std::exception& ex) {
if (typeid(ex) != typeid(b_error)) {
fprintf(stderr, "Unexpected error %s: %s\n", typeid(ex).name(), ex.what());
}
detach_database();
throw;
}
@ -579,7 +604,8 @@ void nbackup::backup_database(int level, const char* fname) {
ULONG curPage = 0;
while (true) {
if (curPage && page_buff->pag_scn() > backup_scn)
b_error::raise("Internal error. Database had been changed during backup");
b_error::raise("Internal error. Database page %d had been changed during backup"
" (page SCN=%d, backup SCN=%d)", curPage, page_buff->pag_scn(), backup_scn);
if (level) {
if (page_buff->pag_scn() > prev_scn) {
write_file(backup, &curPage, sizeof(curPage));
@ -642,7 +668,10 @@ void nbackup::backup_database(int level, const char* fname) {
if (isc_commit_transaction(status, &trans))
pr_error(status, "commit history insert");
} catch (const std::exception&) {
} catch (const std::exception& ex) {
if (typeid(ex) != typeid(b_error)) {
fprintf(stderr, "Unexpected error %s: %s\n", typeid(ex).name(), ex.what());
}
free(page_buff);
if (delete_backup)
unlink(bakname);
@ -793,7 +822,10 @@ void nbackup::restore_database(int filecount, char* files[]) {
close_backup();
curLevel++;
}
} catch(const std::exception&) {
} catch(const std::exception& ex) {
if (typeid(ex) != typeid(b_error)) {
fprintf(stderr, "Unexpected error %s: %s\n", typeid(ex).name(), ex.what());
}
free(page);
if (delete_database)
unlink(dbname);
@ -855,7 +887,7 @@ int main( int argc, char *argv[] )
}
} catch (const std::exception& ex) {
fprintf(stderr, "Failure: %s\n", ex.what());
// It must have been printed out. No need to repeat the task
return EXIT_ERROR;
}

View File

@ -1279,7 +1279,7 @@ static SSHORT grpc_wait_for_grouping(
&ptr,
&value,
WAL_handle->wal_grpc_wait_usecs,
reinterpret_cast < void (*)() > (WALC_alarm_handler), ptr);
WALC_alarm_handler, ptr);
/* Now make sure that the other group-commit block is available */
@ -1292,8 +1292,7 @@ static SSHORT grpc_wait_for_grouping(
ptr = &WAL_EVENTS[WAL_GCOMMIT_STALL_SEM];
ISC_event_wait(1, &ptr, &value,
WAL_handle->wal_grpc_wait_other_coord_usecs,
reinterpret_cast < void (*)() > (WALC_alarm_handler),
ptr);
WALC_alarm_handler, ptr);
WALC_acquire(WAL_handle, &WAL_segment);
WAL_CHECK_BUG(WAL_handle, WAL_segment);
if ((WAL_segment->wals_flags & WALS_GRP_COMMIT_IN_PROGRESS) &&
@ -1359,10 +1358,10 @@ GRP_COMMIT * grpc)
ptr = &WAL_EVENTS[grpc->grp_commit_event_num];
value = ISC_event_clear(ptr);
WALC_release(WAL_handle);
while (ISC_event_wait
(1, &ptr, &value, WAL_handle->wal_grpc_wait_coord_usecs,
reinterpret_cast < void (*)() > (WALC_alarm_handler),
ptr) != FB_SUCCESS) {
while (ISC_event_wait(1, &ptr, &value,
WAL_handle->wal_grpc_wait_coord_usecs,
WALC_alarm_handler, ptr) != FB_SUCCESS)
{
/* Check to make sure that the coordinator is still alive. */
WALC_acquire(WAL_handle, &WAL_segment);
@ -1576,8 +1575,7 @@ static SSHORT wait_for_writer( ISC_STATUS * status_vector, WAL WAL_handle)
ret =
ISC_event_wait(1, &ptr, &value, WAIT_TIME,
reinterpret_cast < void (*)() > (WALC_alarm_handler),
ptr);
WALC_alarm_handler, ptr);
if (ret == FB_FAILURE) {
/* We got out because of timeout. May be our condition is
already met. Let the caller decide that. In any case, make

View File

@ -41,7 +41,7 @@
#include "../jrd/gds_proto.h"
#include "../jrd/iberr_proto.h"
#include "../jrd/isc_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/llio_proto.h"
@ -177,7 +177,7 @@ void WALC_acquire( WAL WAL_handle, WALS * address)
}
void WALC_alarm_handler( EVENT event)
void WALC_alarm_handler(void* _event)
{
/**************************************
*
@ -195,7 +195,7 @@ void WALC_alarm_handler( EVENT event)
*
**************************************/
ISC_event_post(event);
ISC_event_post(reinterpret_cast<EVENT>(_event));
}

View File

@ -25,7 +25,7 @@
#define _WAL_WALC_PROTO_H_
extern void WALC_acquire (struct wal *, struct wals **);
extern void WALC_alarm_handler (struct event *);
extern void WALC_alarm_handler (void *);
extern SSHORT WALC_bug (ISC_STATUS *, TEXT *, TEXT *);
extern void WALC_build_dbg_filename (TEXT *, TEXT *);
extern void WALC_build_logname (TEXT *, TEXT *, SLONG);

View File

@ -47,7 +47,7 @@
#include "../wal/walw_proto.h"
#include "../jrd/gds_proto.h"
#include "../jrd/iberr_proto.h"
#include "../jrd/isc_i_proto.h"
#include "../jrd/os/isc_i_proto.h"
#include "../jrd/isc_s_proto.h"
#include "../jrd/jrn_proto.h"
#include "../jrd/llio_proto.h"
@ -493,8 +493,7 @@ static SSHORT WALW_writer(ISC_STATUS * status_vector, WAL WAL_handle)
WALC_release(WAL_handle);
acquired = false;
ISC_event_wait(1, &ptr, &value, WALW_WRITER_TIMEOUT_USECS,
reinterpret_cast < void (*)() >
(WALC_alarm_handler), ptr);
WALC_alarm_handler, ptr);
continue;
}