mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:03:02 +01:00
Moved the Services API into the engine on threadable platforms.
This commit is contained in:
parent
2deaa4f1fd
commit
7a343b8162
@ -63,7 +63,7 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include "../utilities/common/cmd_util_proto.h"
|
||||
#endif
|
||||
|
||||
@ -81,9 +81,9 @@ static const USHORT val_err_table[] = {
|
||||
|
||||
// The following structure in only needed if we are building a local exe
|
||||
// I've commented it out to make it clear since this global variable is
|
||||
// defined in burp.cpp as well, and is not relevant for SUPERSERVER
|
||||
// defined in burp.cpp as well, and is not relevant for SERVICE_THREAD
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
AliceGlobals* gdgbl;
|
||||
#endif
|
||||
|
||||
@ -102,7 +102,7 @@ static bool fAnsiCP = false;
|
||||
static void ALICE_error(USHORT number); // overloaded to keep down param count
|
||||
static inline void translate_cp(TEXT* sz);
|
||||
static void expand_filename(const TEXT*, TEXT*);
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
static int output_main(Jrd::Service*, const UCHAR*);
|
||||
#endif
|
||||
static int common_main(int, char**, Jrd::pfn_svc_output, Jrd::Service*);
|
||||
@ -123,7 +123,7 @@ static int output_svc(Jrd::Service* output_data, const UCHAR * output_buf)
|
||||
}
|
||||
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
@ -148,7 +148,7 @@ THREAD_ENTRY_DECLARE ALICE_main(THREAD_ENTRY_PARAM arg)
|
||||
// Routine which is passed to GFIX for calling back when there is output.
|
||||
//
|
||||
|
||||
#else // SUPERSERVER
|
||||
#else // SERVICE_THREAD
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
@ -174,7 +174,7 @@ static int output_main(Jrd::Service* output_data, const UCHAR* output_buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // SUPERSERVER
|
||||
#endif // SERVICE_THREAD
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
@ -533,14 +533,14 @@ int common_main(int argc,
|
||||
}
|
||||
|
||||
if (!switches || !(switches & ~(sw_user | sw_password))) {
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
ALICE_print(20, 0, 0, 0, 0, 0); // msg 20: please retry, specifying an option
|
||||
#endif
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tdgbl->service_blk->svc_status, ALICE_MSG_FAC,
|
||||
20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
@ -621,7 +621,7 @@ int common_main(int argc,
|
||||
|
||||
AliceGlobals::restoreSpecific();
|
||||
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SERVICE_THREAD)
|
||||
gds_alloc_report(0, __FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
@ -680,7 +680,7 @@ void ALICE_print_status(const ISC_STATUS* status_vector)
|
||||
if (status_vector)
|
||||
{
|
||||
const ISC_STATUS* vector = status_vector;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
ISC_STATUS* status = tdgbl->service_blk->svc_status;
|
||||
if (status != status_vector) {
|
||||
@ -728,7 +728,7 @@ void ALICE_error(USHORT number,
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
TEXT buffer[256];
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
ISC_STATUS* status = tdgbl->service_blk->svc_status;
|
||||
|
||||
CMD_UTIL_put_svc_status(status, ALICE_MSG_FAC, number,
|
||||
|
@ -145,7 +145,7 @@ enum redirect_vals {
|
||||
};
|
||||
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
class AliceGlobals;
|
||||
extern AliceGlobals* gdgbl;
|
||||
#endif
|
||||
@ -191,7 +191,7 @@ public:
|
||||
bool sw_service;
|
||||
bool sw_service_thd;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static inline AliceGlobals* getSpecific() {
|
||||
ThreadData* tData = ThreadData::getSpecific();
|
||||
fb_assert (tData->getType() == ThreadData::tddALICE)
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "../jrd/thd.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
THREAD_ENTRY_DECLARE ALICE_main(THREAD_ENTRY_PARAM);
|
||||
#endif
|
||||
|
||||
|
@ -308,7 +308,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches
|
||||
ALICE_print(71, reinterpret_cast<char*>(id), 0, 0, 0, 0);
|
||||
// msg 71: Transaction %d is in limbo.
|
||||
if (trans = MET_get_transaction(status_vector, handle, id)) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_multi_tra_id);
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) id);
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) (id >> 8));
|
||||
@ -320,7 +320,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches
|
||||
TDR_shutdown_databases(trans);
|
||||
print_description(trans);
|
||||
}
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
else {
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_single_tra_id);
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) id);
|
||||
@ -522,7 +522,7 @@ static void print_description(const tdr* trans)
|
||||
const char* pszHostSize =
|
||||
reinterpret_cast<const char*>(ptr->tdr_host_site->str_data);
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
// msg 93: Host Site: %s
|
||||
ALICE_print(93, pszHostSize, 0, 0, 0, 0);
|
||||
#else
|
||||
@ -540,7 +540,7 @@ static void print_description(const tdr* trans)
|
||||
|
||||
if (ptr->tdr_id)
|
||||
{
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
// msg 94: Transaction %ld
|
||||
ALICE_print(94, reinterpret_cast<char*>(ptr->tdr_id), 0, 0, 0, 0);
|
||||
#else
|
||||
@ -555,7 +555,7 @@ static void print_description(const tdr* trans)
|
||||
switch (ptr->tdr_state)
|
||||
{
|
||||
case TRA_limbo:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
ALICE_print(95, 0, 0, 0, 0, 0); // msg 95: has been prepared.
|
||||
#else
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state);
|
||||
@ -565,7 +565,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
case TRA_commit:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
ALICE_print(96, 0, 0, 0, 0, 0); // msg 96: has been committed.
|
||||
#else
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state);
|
||||
@ -574,7 +574,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
case TRA_rollback:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
ALICE_print(97, 0, 0, 0, 0, 0); // msg 97: has been rolled back.
|
||||
#else
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state);
|
||||
@ -583,7 +583,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
case TRA_unknown:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
ALICE_print(98, 0, 0, 0, 0, 0); // msg 98: is not available.
|
||||
#else
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state);
|
||||
@ -592,7 +592,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
if (prepared_seen)
|
||||
{
|
||||
// msg 99: is not found, assumed not prepared.
|
||||
@ -612,7 +612,7 @@ static void print_description(const tdr* trans)
|
||||
const char* pszRemoteSite =
|
||||
reinterpret_cast<const char*>(ptr->tdr_remote_site->str_data);
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
//msg 101: Remote Site: %s
|
||||
ALICE_print(101, pszRemoteSite, 0, 0, 0, 0);
|
||||
#else
|
||||
@ -633,7 +633,7 @@ static void print_description(const tdr* trans)
|
||||
const char* pszFullpath =
|
||||
reinterpret_cast<const char*>(ptr->tdr_fullpath->str_data);
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
// msg 102: Database Path: %s
|
||||
ALICE_print(102, pszFullpath, 0, 0, 0, 0);
|
||||
#else
|
||||
@ -656,7 +656,7 @@ static void print_description(const tdr* trans)
|
||||
switch (TDR_analyze(trans))
|
||||
{
|
||||
case TRA_commit:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
// msg 103: Automated recovery would commit this transaction.
|
||||
ALICE_print(103, 0, 0, 0, 0, 0);
|
||||
#else
|
||||
@ -666,7 +666,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
case TRA_rollback:
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
// msg 104: Automated recovery would rollback this transaction.
|
||||
ALICE_print(104, 0, 0, 0, 0, 0);
|
||||
#else
|
||||
@ -676,7 +676,7 @@ static void print_description(const tdr* trans)
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_advise);
|
||||
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_advise_unknown);
|
||||
#endif
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include "../utilities/common/cmd_util_proto.h"
|
||||
#endif
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
|
||||
// The following structure in only needed if we are building a local exe
|
||||
// I've commented it out to make it clear since this global variable is
|
||||
// defined in burp.cpp as well, and is not relevant for SUPERSERVER
|
||||
// defined in burp.cpp as well, and is not relevant for SERVICE_THREAD
|
||||
// MOD 23-July-2002
|
||||
|
||||
const char* fopen_write_type = "w";
|
||||
@ -126,7 +126,7 @@ static ULONG get_size(const SCHAR*, burp_fil*);
|
||||
static gbak_action open_files(const TEXT *, const TEXT**, bool, USHORT,
|
||||
const Firebird::ClumpletWriter&);
|
||||
static int common_main(int, char**, Jrd::pfn_svc_output, Jrd::Service*);
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
BurpGlobals* gdgbl;
|
||||
static int output_main(Jrd::Service*, const UCHAR*);
|
||||
static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, bool, bool);
|
||||
@ -169,7 +169,7 @@ static int output_svc(Jrd::Service* output_data, const UCHAR* output_buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
THREAD_ENTRY_DECLARE BURP_main(THREAD_ENTRY_PARAM arg)
|
||||
{
|
||||
/**************************************
|
||||
@ -194,7 +194,7 @@ THREAD_ENTRY_DECLARE BURP_main(THREAD_ENTRY_PARAM arg)
|
||||
}
|
||||
|
||||
|
||||
#else // SUPERSERVER
|
||||
#else // SERVICE_THREAD
|
||||
|
||||
int CLIB_ROUTINE main(int argc, char* argv[])
|
||||
{
|
||||
@ -559,7 +559,7 @@ static int api_gbak(int argc,
|
||||
}
|
||||
|
||||
|
||||
#endif // SUPERSERVER
|
||||
#endif // SERVICE_THREAD
|
||||
|
||||
|
||||
int common_main(int argc,
|
||||
@ -1195,7 +1195,7 @@ int common_main(int argc,
|
||||
|
||||
BurpGlobals::restoreSpecific();
|
||||
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SERVICE_THREAD)
|
||||
gds_alloc_report(0, __FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
@ -1249,7 +1249,7 @@ void BURP_error(USHORT errcode, bool abort,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||
|
||||
ISC_STATUS *status = tdgbl->service_blk->svc_status;
|
||||
@ -1469,7 +1469,7 @@ void BURP_print_status(const ISC_STATUS* status_vector)
|
||||
**************************************/
|
||||
if (status_vector) {
|
||||
const ISC_STATUS* vector = status_vector;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||
ISC_STATUS* status = tdgbl->service_blk->svc_status;
|
||||
if (status != status_vector) {
|
||||
|
@ -772,7 +772,7 @@ static const char HDR_SPLIT_TAG6[] = "InterBase/gbak, ";
|
||||
const unsigned int MIN_SPLIT_SIZE = 2048; // bytes
|
||||
|
||||
// Global switches and data
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
class BurpGlobals;
|
||||
extern BurpGlobals* gdgbl;
|
||||
#endif
|
||||
@ -911,7 +911,7 @@ public:
|
||||
isc_req_handle handles_write_procedure_prms_req_handle1;
|
||||
USHORT hdr_forced_writes;
|
||||
TEXT database_security_class[GDS_NAME_LEN]; // To save database security class for deferred update
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static inline BurpGlobals* getSpecific() {
|
||||
return (BurpGlobals*) ThreadData::getSpecific();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "../jrd/thd.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef MULTI_THREAD
|
||||
THREAD_ENTRY_DECLARE BURP_main(THREAD_ENTRY_PARAM);
|
||||
#endif
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "../burp/burp_proto.h"
|
||||
#include "../burp/misc_proto.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include "../jrd/thd.h"
|
||||
#endif
|
||||
|
||||
|
@ -130,5 +130,8 @@ using namespace NAMESPACE;
|
||||
#define THREAD_PSCHED
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDE_Firebird_H */
|
||||
#if defined(MULTI_THREAD) && !defined(SUPERCLIENT)
|
||||
#define SERVICE_THREAD
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDE_Firebird_H */
|
||||
|
502
src/jrd/svc.cpp
502
src/jrd/svc.cpp
@ -179,10 +179,6 @@ static const TEXT* find_switch(int, const in_sw_tab_t*);
|
||||
static USHORT process_switches(USHORT, const SCHAR*, TEXT*);
|
||||
static void get_options(const UCHAR*, USHORT, TEXT*, Serv_param_block*);
|
||||
static TEXT* get_string_parameter(const UCHAR**, TEXT**);
|
||||
#ifndef SUPERSERVER
|
||||
static void io_error(const TEXT*, SLONG, const TEXT*, ISC_STATUS, bool);
|
||||
static void service_close(Service*);
|
||||
#endif
|
||||
static bool get_action_svc_bitmask(const TEXT**, const in_sw_tab_t*,
|
||||
TEXT**, USHORT*, USHORT*);
|
||||
static void get_action_svc_string(const TEXT**, TEXT**, USHORT*, USHORT*);
|
||||
@ -190,7 +186,7 @@ static void get_action_svc_data(const TEXT**, TEXT**, USHORT*, USHORT*);
|
||||
static bool get_action_svc_parameter(const TEXT**, const in_sw_tab_t*,
|
||||
TEXT**, USHORT*, USHORT*);
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static UCHAR service_dequeue_byte(Service*);
|
||||
static void service_enqueue_byte(UCHAR, Service*);
|
||||
static USHORT service_add_one(USHORT i);
|
||||
@ -198,16 +194,13 @@ static USHORT service_empty(Service* service);
|
||||
static USHORT service_full(Service* service);
|
||||
static void service_fork(ThreadEntryPoint*, Service*);
|
||||
#else
|
||||
static void io_error(const TEXT*, SLONG, const TEXT*, ISC_STATUS);
|
||||
static void service_close(Service*);
|
||||
static void service_fork(TEXT*, Service*);
|
||||
static void timeout_handler(void* service);
|
||||
#endif
|
||||
static void service_get(Service*, SCHAR *, USHORT, USHORT, USHORT, USHORT *);
|
||||
static void service_put(Service*, const SCHAR*, USHORT);
|
||||
#if !defined(WIN_NT) && !defined(SUPERSERVER)
|
||||
static void timeout_handler(void* service);
|
||||
#endif
|
||||
#if defined(WIN_NT) && !defined(SUPERSERVER)
|
||||
static USHORT service_read(Service*, SCHAR *, USHORT, USHORT);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
THREAD_ENTRY_DECLARE test_thread(THREAD_ENTRY_PARAM);
|
||||
@ -229,7 +222,7 @@ const char* const SPB_SEC_USERNAME = "isc_spb_sec_username";
|
||||
static MUTX_T svc_mutex[1], thd_mutex[1];
|
||||
|
||||
/* Service Functions */
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include "../burp/burp_proto.h"
|
||||
#include "../alice/alice_proto.h"
|
||||
int main_lock_print();
|
||||
@ -247,7 +240,7 @@ THREAD_ENTRY_DECLARE main_gstat(THREAD_ENTRY_PARAM arg);
|
||||
#define MAIN_GSEC NULL
|
||||
#endif
|
||||
|
||||
#if defined(SUPERSERVER) && !defined(EMBEDDED)
|
||||
#if defined(SERVICE_THREAD) && !defined(EMBEDDED)
|
||||
#include "../utilities/gsec/gsec_proto.h"
|
||||
#define MAIN_GSEC GSEC_main
|
||||
#else
|
||||
@ -574,7 +567,7 @@ Service* SVC_attach(USHORT service_length,
|
||||
service->svc_handle = 0;
|
||||
service->svc_user_flag = user_flag;
|
||||
service->svc_do_shutdown = false;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
service->svc_stdout_head = 1;
|
||||
service->svc_stdout_tail = SVC_STDOUT_BUFFER_SIZE;
|
||||
service->svc_stdout = NULL;
|
||||
@ -601,13 +594,13 @@ Service* SVC_attach(USHORT service_length,
|
||||
/* If an executable is defined for the service, try to fork a new process.
|
||||
* Only do this if we are working with a version 1 service */
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
if (serv->serv_executable && options.spb_version == isc_spb_version1)
|
||||
#else
|
||||
if (serv->serv_thd && options.spb_version == isc_spb_version1)
|
||||
#endif
|
||||
{
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
TEXT service_path[MAXPATHLEN];
|
||||
gds__prefix(service_path, serv->serv_executable);
|
||||
service_fork(service_path, service);
|
||||
@ -690,7 +683,7 @@ void SVC_detach(Service* service)
|
||||
}
|
||||
#endif /* SERVER_SHUTDOWN */
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
|
||||
/* Mark service as detached. */
|
||||
/* If service thread is finished, cleanup memory being used by service. */
|
||||
@ -742,7 +735,7 @@ void SVC_shutdown_init(shutdown_fct_t fptr,
|
||||
#endif // SERVER_SHUTDOWN
|
||||
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
void SVC_fprintf(Service* service, const SCHAR* format, ...)
|
||||
{
|
||||
/**************************************
|
||||
@ -811,7 +804,7 @@ int SVC_output(Service* output_data, const UCHAR* output_buf)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /*SUPERSERVER*/
|
||||
#endif /*SERVICE_THREAD*/
|
||||
|
||||
ISC_STATUS SVC_query2(Service* service,
|
||||
thread_db* tdbb,
|
||||
@ -1838,7 +1831,7 @@ void* SVC_start(Service* service, USHORT spb_length, const SCHAR* spb)
|
||||
if (service->svc_switches == NULL && *spb != isc_action_svc_get_ib_log)
|
||||
ERR_post(isc_bad_spb_form, 0);
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
TEXT service_path[MAXPATHLEN];
|
||||
|
||||
if (serv->serv_executable) {
|
||||
@ -1982,7 +1975,7 @@ void* SVC_start(Service* service, USHORT spb_length, const SCHAR* spb)
|
||||
0);
|
||||
}
|
||||
|
||||
#endif /* SUPERSERVER */
|
||||
#endif /* SERVICE_THREAD */
|
||||
|
||||
} // try
|
||||
catch (const std::exception&) {
|
||||
@ -2015,7 +2008,7 @@ THREAD_ENTRY_DECLARE SVC_read_ib_log(THREAD_ENTRY_PARAM arg)
|
||||
**************************************/
|
||||
bool svc_started = false;
|
||||
Service* service = (Service*)arg;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
ISC_STATUS *status = service->svc_status;
|
||||
*status++ = isc_arg_gds;
|
||||
#endif
|
||||
@ -2024,7 +2017,7 @@ THREAD_ENTRY_DECLARE SVC_read_ib_log(THREAD_ENTRY_PARAM arg)
|
||||
gds__prefix(name, LOGFILE);
|
||||
FILE* file = fopen(name, "r");
|
||||
if (file != NULL) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
*status++ = FB_SUCCESS;
|
||||
*status++ = isc_arg_end;
|
||||
#endif
|
||||
@ -2033,7 +2026,7 @@ THREAD_ENTRY_DECLARE SVC_read_ib_log(THREAD_ENTRY_PARAM arg)
|
||||
TEXT buffer[100];
|
||||
while (!feof(file) && !ferror(file)) {
|
||||
fgets(buffer, sizeof(buffer), file);
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
SVC_fprintf(service, "%s", buffer);
|
||||
#else
|
||||
service_put(service, buffer, sizeof(buffer));
|
||||
@ -2042,7 +2035,7 @@ THREAD_ENTRY_DECLARE SVC_read_ib_log(THREAD_ENTRY_PARAM arg)
|
||||
}
|
||||
|
||||
if (!file || file && ferror(file)) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
*status++ = isc_sys_request;
|
||||
if (!file) {
|
||||
SVC_STATUS_ARG(status, isc_arg_string, (void*)"fopen");
|
||||
@ -2063,7 +2056,7 @@ THREAD_ENTRY_DECLARE SVC_read_ib_log(THREAD_ENTRY_PARAM arg)
|
||||
if (file)
|
||||
fclose(file);
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
SVC_finish(service, SVC_finished);
|
||||
#else
|
||||
SVC_cleanup(service);
|
||||
@ -2164,12 +2157,10 @@ static TEXT* get_string_parameter(const UCHAR** spb_ptr, TEXT** opt_ptr)
|
||||
}
|
||||
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
static void io_error(
|
||||
const TEXT* string,
|
||||
#ifndef SERVICE_THREAD
|
||||
static void io_error(const TEXT* string,
|
||||
SLONG status,
|
||||
const TEXT* filename, ISC_STATUS operation,
|
||||
bool reenter_flag)
|
||||
const TEXT* filename, ISC_STATUS operation)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2178,439 +2169,17 @@ static void io_error(
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Report an I/O error. If the reenter_flag
|
||||
* is true, re-enter the scheduler.
|
||||
* Report an I/O error.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
#ifdef MULTI_THREAD
|
||||
if (reenter_flag)
|
||||
THREAD_ENTER();
|
||||
#endif
|
||||
|
||||
ERR_post(isc_io_error, isc_arg_string, string, isc_arg_string, filename,
|
||||
isc_arg_gds, operation, SYS_ERR, status, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN_NT
|
||||
#ifndef SUPERSERVER
|
||||
static void service_close(Service* service)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e r v i c e _ c l o s e ( W I N _ N T )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Shutdown the connection to a service.
|
||||
* Simply close the input and output pipes.
|
||||
*
|
||||
**************************************/
|
||||
CloseHandle((HANDLE) service->svc_input);
|
||||
CloseHandle((HANDLE) service->svc_output);
|
||||
}
|
||||
|
||||
|
||||
static void service_fork(TEXT* service_path, Service* service)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e r v i c e _ f o r k ( W I N _ N T )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Startup a service.
|
||||
*
|
||||
**************************************/
|
||||
SECURITY_ATTRIBUTES attr;
|
||||
const bool windows_nt = ISC_is_WinNT();
|
||||
|
||||
/* Only Create the pipes on Windows NT. There is a bug on Windows
|
||||
95 that prohibits these handles from being converted by the
|
||||
child process
|
||||
*/
|
||||
HANDLE my_input, my_output, pipe_input, pipe_output, pipe_error;
|
||||
my_input = pipe_output = my_output = pipe_input = INVALID_HANDLE_VALUE;
|
||||
if (windows_nt) {
|
||||
/* Set up input and output pipes and make them the stdin, stdout,
|
||||
and stderr of the forked process. */
|
||||
|
||||
attr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
attr.bInheritHandle = TRUE;
|
||||
attr.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!CreatePipe(&my_input, &pipe_output, &attr, 0) ||
|
||||
!CreatePipe(&pipe_input, &my_output, &attr, 0) ||
|
||||
!DuplicateHandle(GetCurrentProcess(), pipe_output,
|
||||
GetCurrentProcess(), &pipe_error, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS))
|
||||
{
|
||||
const SLONG status = GetLastError();
|
||||
CloseHandle(my_input);
|
||||
CloseHandle(pipe_output);
|
||||
CloseHandle(my_output);
|
||||
CloseHandle(pipe_input);
|
||||
ERR_post(isc_sys_request, isc_arg_string,
|
||||
(my_output != INVALID_HANDLE_VALUE) ?
|
||||
"CreatePipe" : "DuplicateHandle",
|
||||
SYS_ERR, status, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Create a temporary file and get the OS handle to
|
||||
the file created. This handle will be used in subsequent
|
||||
calls to the windows API functions for working with the files
|
||||
*/
|
||||
char tmpPath[MAXPATHLEN];
|
||||
|
||||
GetTempPath(MAXPATHLEN, tmpPath);
|
||||
const char* fname = _tempnam(tmpPath, "ibsvc");
|
||||
int tmp =
|
||||
_open(fname, _O_RDWR | _O_CREAT | _O_TEMPORARY,
|
||||
_S_IREAD | _S_IWRITE);
|
||||
my_input = (HANDLE) _get_osfhandle(tmp);
|
||||
|
||||
fname = _tempnam(tmpPath, "ibsvc");
|
||||
tmp =
|
||||
_open(fname, _O_RDWR | _O_CREAT | _O_TEMPORARY,
|
||||
_S_IREAD | _S_IWRITE);
|
||||
my_output = (HANDLE) _get_osfhandle(tmp);
|
||||
|
||||
if (my_input == INVALID_HANDLE_VALUE ||
|
||||
my_output == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(my_input);
|
||||
CloseHandle(my_output);
|
||||
ERR_post(isc_sys_request, isc_arg_string, "CreateFile", SYS_ERR,
|
||||
errno, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we have buffers that are large enough to hold the number
|
||||
and size of the command line arguments. Add some extra space for
|
||||
the pipe's file handles. */
|
||||
|
||||
TEXT* p;
|
||||
|
||||
USHORT len = strlen(service_path) + strlen(service->svc_switches) + 16;
|
||||
for (p = service->svc_switches; *p;)
|
||||
if (*p++ == ' ')
|
||||
len += 2;
|
||||
|
||||
TEXT argv_data_buf[512];
|
||||
TEXT* argv_data;
|
||||
if (len > sizeof(argv_data_buf))
|
||||
argv_data = (TEXT*) gds__alloc((SLONG) len);
|
||||
else
|
||||
argv_data = argv_data_buf;
|
||||
/* FREE: at procedure return */
|
||||
if (!argv_data) /* NOMEM: */
|
||||
ERR_post(isc_virmemexh, 0);
|
||||
|
||||
/* Create a command line. */
|
||||
|
||||
bool svc_flag = false; // Unless there's some ugly macro, this var seems useless
|
||||
|
||||
const TEXT* q = service_path;
|
||||
for (p = argv_data; *p = *q++; p++);
|
||||
|
||||
q = service->svc_switches;
|
||||
if (*q)
|
||||
*p++ = ' ';
|
||||
|
||||
while (*q == ' ')
|
||||
q++;
|
||||
bool user_quote = false;
|
||||
while (*q) {
|
||||
TEXT* arg = p;
|
||||
*p++ = '\"';
|
||||
bool quote_flag = false;
|
||||
while (((*p = *q++) && *p != ' ') || user_quote) {
|
||||
if (*p == '\\' && *q == ' ' && !user_quote) {
|
||||
*p = ' ';
|
||||
q++;
|
||||
quote_flag = true;
|
||||
}
|
||||
if (*p == '"') {
|
||||
user_quote = !user_quote;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
if (!quote_flag) {
|
||||
*arg = ' ';
|
||||
if (!strncmp(arg, " -svc", p - arg)) {
|
||||
if (windows_nt)
|
||||
sprintf(p, "_re %lu %lu %lu", (ULONG) pipe_input, (ULONG) pipe_output,
|
||||
(ULONG) pipe_error);
|
||||
else
|
||||
sprintf(p, "_re %lu %lu %lu", (ULONG) my_output, (ULONG) my_input,
|
||||
(ULONG) my_output);
|
||||
p += strlen(p);
|
||||
*p = q[-1];
|
||||
svc_flag = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
p[1] = p[0];
|
||||
*p++ = '\"';
|
||||
}
|
||||
if (!*p)
|
||||
break;
|
||||
*p++ = ' ';
|
||||
while (*q == ' ')
|
||||
q++;
|
||||
}
|
||||
|
||||
for (p = argv_data; *p; p++) {
|
||||
if (*p == SVC_TRMNTR)
|
||||
*p = ' ';
|
||||
}
|
||||
|
||||
THREAD_EXIT();
|
||||
|
||||
STARTUPINFO start_crud;
|
||||
start_crud.cb = sizeof(STARTUPINFO);
|
||||
start_crud.lpReserved = NULL;
|
||||
start_crud.lpReserved2 = NULL;
|
||||
start_crud.cbReserved2 = 0;
|
||||
start_crud.lpDesktop = NULL;
|
||||
start_crud.lpTitle = NULL;
|
||||
start_crud.dwFlags = STARTF_USESHOWWINDOW;
|
||||
start_crud.wShowWindow = SW_HIDE;
|
||||
|
||||
PROCESS_INFORMATION pi;
|
||||
const USHORT ret = CreateProcess(NULL,
|
||||
argv_data,
|
||||
NULL,
|
||||
NULL,
|
||||
TRUE,
|
||||
NORMAL_PRIORITY_CLASS,
|
||||
NULL,
|
||||
NULL,
|
||||
&start_crud, &pi);
|
||||
const SLONG status = ret ? 0 : GetLastError();
|
||||
|
||||
if (windows_nt) {
|
||||
CloseHandle(pipe_input);
|
||||
CloseHandle(pipe_output);
|
||||
CloseHandle(pipe_error);
|
||||
}
|
||||
THREAD_ENTER();
|
||||
|
||||
if (argv_data != argv_data_buf)
|
||||
gds__free(argv_data);
|
||||
|
||||
if (!ret)
|
||||
ERR_post(isc_sys_request, isc_arg_string, "CreateProcess", SYS_ERR,
|
||||
status, 0);
|
||||
|
||||
DuplicateHandle(GetCurrentProcess(), pi.hProcess,
|
||||
GetCurrentProcess(), (PHANDLE) & service->svc_handle,
|
||||
0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
service->svc_input = (void *) my_input;
|
||||
service->svc_output = (void *) my_output;
|
||||
}
|
||||
|
||||
|
||||
static void service_get(Service* service,
|
||||
SCHAR * buffer,
|
||||
USHORT length,
|
||||
USHORT flags,
|
||||
USHORT timeout,
|
||||
USHORT * return_length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e r v i c e _ g e t ( W I N _ N T )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get input from a service. It is assumed
|
||||
* that we have checked out of the scheduler.
|
||||
*
|
||||
**************************************/
|
||||
SLONG n = 0L;
|
||||
SCHAR *buf = buffer;
|
||||
/* Kludge for PeekNamedPipe to work on Win NT 3.5 */
|
||||
UCHAR temp_buf[600];
|
||||
DWORD temp_len;
|
||||
const bool windows_nt = ISC_is_WinNT();
|
||||
|
||||
*return_length = 0;
|
||||
service->svc_flags &= ~SVC_timeout;
|
||||
is_service_running(service);
|
||||
|
||||
if (timeout) {
|
||||
/* If a timeout period was given, check every .1 seconds to see if
|
||||
input is available from the pipe. When something shows up, read
|
||||
what's available until all data has been read, or timeout occurs.
|
||||
Otherwise, set the timeout flag and return.
|
||||
Fall out of the loop if a BROKEN_PIPE error occurs.
|
||||
*/
|
||||
SSHORT iter = timeout * 10; // nice signed/unsigned assignment. :-)
|
||||
while ((iter--) && ((buf - buffer) < length)) {
|
||||
/* PeekNamedPipe sometimes return wrong &n, need to get real
|
||||
length from &temp_len until it works */
|
||||
if (windows_nt
|
||||
&& !PeekNamedPipe((HANDLE) service->svc_input, temp_buf, 600,
|
||||
&temp_len, (ULONG*) &n, NULL))
|
||||
{
|
||||
if (GetLastError() == ERROR_BROKEN_PIPE) {
|
||||
service->svc_flags |= SVC_finished;
|
||||
break;
|
||||
}
|
||||
io_error("PeekNamedPipe", GetLastError(), "service pipe",
|
||||
isc_io_read_err, true);
|
||||
}
|
||||
else {
|
||||
DWORD dwCurrentFilePosition;
|
||||
/* Set the file pointer to the beginning of the file if we are at the end of the
|
||||
file. */
|
||||
temp_len = GetFileSize(service->svc_input, NULL);
|
||||
dwCurrentFilePosition =
|
||||
SetFilePointer(service->svc_input, 0, NULL, FILE_CURRENT);
|
||||
|
||||
if (temp_len && temp_len == dwCurrentFilePosition)
|
||||
SetFilePointer(service->svc_input, 0, NULL, FILE_BEGIN);
|
||||
}
|
||||
|
||||
if (temp_len) {
|
||||
/* If data is available, read as much as will fit in buffer */
|
||||
temp_len = MIN(temp_len, (DWORD) (length - (buf - buffer)));
|
||||
const USHORT bytes_read =
|
||||
service_read(service, buf, (USHORT) temp_len, flags);
|
||||
buf += bytes_read;
|
||||
|
||||
if (bytes_read < temp_len
|
||||
|| service->svc_flags & SVC_finished)
|
||||
{
|
||||
/* We stopped w/out reading full length, must have hit
|
||||
a newline or special character. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* PeekNamedPipe() is not returning ERROR_BROKEN_PIPE in WIN95. So,
|
||||
we are going to use WaitForSingleObject() to check if the process
|
||||
on the other end of the pipe is still active. */
|
||||
if (!windows_nt &&
|
||||
WaitForSingleObject((HANDLE) service->svc_handle,
|
||||
1) != WAIT_TIMEOUT)
|
||||
{
|
||||
service->svc_flags |= SVC_finished;
|
||||
break;
|
||||
}
|
||||
|
||||
/* No data, so wait a while */
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
/* If we timed out, set the appropriate flags */
|
||||
if (iter < 0 && !(service->svc_flags & SVC_finished))
|
||||
service->svc_flags |= SVC_timeout;
|
||||
}
|
||||
else {
|
||||
buf += service_read(service, buf, length, flags);
|
||||
}
|
||||
|
||||
*return_length = buf - buffer;
|
||||
}
|
||||
|
||||
|
||||
static void service_put(Service* service, const SCHAR* buffer, USHORT length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e r v i c e _ p u t ( W I N _ N T )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Send output to a service. It is assumed
|
||||
* that we have checked out of the scheduler.
|
||||
*
|
||||
**************************************/
|
||||
SLONG n;
|
||||
|
||||
is_service_running(service);
|
||||
|
||||
while (length) {
|
||||
if (!WriteFile((HANDLE) service->svc_output, buffer, (SLONG) length,
|
||||
(ULONG*) &n, NULL))
|
||||
{
|
||||
io_error("WriteFile", GetLastError(), "service pipe",
|
||||
isc_io_write_err, true);
|
||||
}
|
||||
length -= (USHORT) n;
|
||||
buffer += n;
|
||||
}
|
||||
|
||||
if (!FlushFileBuffers((HANDLE) service->svc_output))
|
||||
io_error("FlushFileBuffers", GetLastError(), "service pipe",
|
||||
isc_io_write_err, true);
|
||||
}
|
||||
|
||||
|
||||
static USHORT service_read(Service* service, SCHAR * buffer, USHORT length, USHORT flags)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e r v i c e _ r e a d ( W I N _ N T )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Read data from the named pipe.
|
||||
* Returns true if there is more data to be
|
||||
* read, false if we found the newline or
|
||||
* special character.
|
||||
*
|
||||
**************************************/
|
||||
SCHAR* buf = buffer;
|
||||
|
||||
while (length) {
|
||||
SLONG n = 0;
|
||||
const SLONG len = (flags & GET_BINARY) ? length : 1;
|
||||
if (ReadFile((HANDLE) service->svc_input, buf, len, (ULONG*) &n, NULL) ||
|
||||
GetLastError() == ERROR_BROKEN_PIPE)
|
||||
{
|
||||
if (!n) {
|
||||
service->svc_flags |= SVC_finished;
|
||||
break;
|
||||
}
|
||||
length -= (USHORT) n;
|
||||
buf += n;
|
||||
if (((flags & GET_LINE) && buf[-1] == '\n') ||
|
||||
(!(flags & GET_BINARY) && buf[-1] == '\001'))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
io_error("ReadFile", GetLastError(), "service pipe",
|
||||
isc_io_read_err, true);
|
||||
}
|
||||
|
||||
if ((flags & GET_LINE) && buf[-1] == '\n')
|
||||
buf[-1] = ' ';
|
||||
|
||||
return buf - buffer;
|
||||
}
|
||||
#endif /* ifndef SUPERSERVER */
|
||||
#endif /* WIN_NT */
|
||||
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static USHORT service_add_one(USHORT i)
|
||||
{
|
||||
/**************************************
|
||||
@ -2851,10 +2420,10 @@ static void service_put(Service* service, const SCHAR* buffer, USHORT length)
|
||||
|
||||
/* Nothing */
|
||||
}
|
||||
#endif /* SUPERSERVER */
|
||||
#endif /* SERVICE_THREAD */
|
||||
|
||||
|
||||
#if !defined(WIN_NT) && !defined(SUPERSERVER)
|
||||
#ifndef SERVICE_THREAD
|
||||
static void service_close(Service* service)
|
||||
{
|
||||
/**************************************
|
||||
@ -2889,13 +2458,13 @@ static void service_fork(TEXT* service_path, Service* service)
|
||||
int pair1[2], pair2[2];
|
||||
|
||||
if (pipe(pair1) < 0 || pipe(pair2) < 0)
|
||||
io_error("pipe", errno, "", isc_io_create_err, false);
|
||||
io_error("pipe", errno, "", isc_io_create_err);
|
||||
|
||||
/* Probe service executable to see it if plausibly exists. */
|
||||
|
||||
struct stat stat_buf;
|
||||
if (statistics(service_path, &stat_buf) == -1)
|
||||
io_error("stat", errno, service_path, isc_io_access_err, false);
|
||||
io_error("stat", errno, service_path, isc_io_access_err);
|
||||
|
||||
/* Make sure we have buffers that are large enough to hold the number
|
||||
and size of the command line arguments. */
|
||||
@ -3064,8 +2633,7 @@ static void service_fork(TEXT* service_path, Service* service)
|
||||
if (!(service->svc_input = (void *) fdopen(pair1[0], "r")) ||
|
||||
!(service->svc_output = (void *) fdopen(pair2[1], "w")))
|
||||
{
|
||||
io_error("fdopen", errno, "service path", isc_io_access_err,
|
||||
false);
|
||||
io_error("fdopen", errno, "service path", isc_io_access_err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3128,8 +2696,7 @@ static void service_get(
|
||||
if (timeout)
|
||||
ISC_reset_timer(timeout_handler, service, (SLONG*)&sv_timr,
|
||||
(void**)&sv_hndlr);
|
||||
io_error("getc", errno_save, "service pipe", isc_io_read_err,
|
||||
true);
|
||||
io_error("getc", errno_save, "service pipe", isc_io_read_err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3167,12 +2734,11 @@ static void service_put(Service* service, const SCHAR* buffer, USHORT length)
|
||||
length++;
|
||||
}
|
||||
else
|
||||
io_error("putc", errno, "service pipe", isc_io_write_err,
|
||||
true);
|
||||
io_error("putc", errno, "service pipe", isc_io_write_err);
|
||||
}
|
||||
|
||||
if (fflush((FILE *) service->svc_output) == EOF)
|
||||
io_error("fflush", errno, "service pipe", isc_io_write_err, true);
|
||||
io_error("fflush", errno, "service pipe", isc_io_write_err);
|
||||
}
|
||||
|
||||
|
||||
@ -3191,7 +2757,7 @@ static void timeout_handler(void* service)
|
||||
*
|
||||
**************************************/
|
||||
}
|
||||
#endif // !defined(WIN_NT) && !defined(SUPERSERVER)
|
||||
#endif // SERVICE_THREAD
|
||||
|
||||
|
||||
void SVC_cleanup(Service* service)
|
||||
@ -3207,7 +2773,7 @@ void SVC_cleanup(Service* service)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
/* If we forked an executable, close down it's pipes */
|
||||
|
||||
if (service->svc_flags & SVC_forked)
|
||||
|
@ -71,7 +71,7 @@ const USHORT isc_action_max = 14;
|
||||
*/
|
||||
#define USERNAME_SWITCH "-USER"
|
||||
#define PASSWORD_SWITCH "-PASSWORD"
|
||||
#if defined ( SUPERSERVER ) || defined ( SUPERCLIENT )
|
||||
#ifdef SERVICE_THREAD
|
||||
#define SERVICE_THD_PARAM "-svc_thd"
|
||||
#else
|
||||
#define SERVICE_THD_PARAM "-svc"
|
||||
@ -137,14 +137,14 @@ const int SVC_cmd_line = 128;
|
||||
// Method used to signify that the service started has done basic
|
||||
// initialization and can be considered a successful startup.
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
|
||||
inline void Service::svc_started()
|
||||
{
|
||||
// null definition, no overhead.
|
||||
}
|
||||
|
||||
#else /* SUPERSERVER */
|
||||
#else /* SERVICE_THREAD */
|
||||
|
||||
inline void Service::svc_started()
|
||||
{
|
||||
@ -155,7 +155,7 @@ inline void Service::svc_started()
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SUPERSERVER */
|
||||
#endif /* SERVICE_THREAD */
|
||||
|
||||
typedef int (*pfn_svc_output)(Service*, const UCHAR*);
|
||||
|
||||
@ -172,4 +172,3 @@ struct serv_entry
|
||||
} //namespace Jrd
|
||||
|
||||
#endif // JRD_SVC_H
|
||||
|
||||
|
@ -64,7 +64,7 @@ static bool fAnsiCP = false;
|
||||
const int MAXARGS = 20; /* max number of args allowed on command line */
|
||||
const int MAXSTUFF = 1000; /* longest interactive command line */
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
class tsec *gdsec;
|
||||
#endif
|
||||
|
||||
@ -76,7 +76,7 @@ static bool get_line(int*, SCHAR**, TEXT*, size_t);
|
||||
static bool get_switches(int, const TEXT* const*, const in_sw_tab_t*, tsec*, bool*);
|
||||
static SSHORT parse_cmd_line(int, const TEXT* const*, tsec*);
|
||||
static void printhelp(void);
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
static int output_main(Jrd::Service*, const UCHAR*);
|
||||
#endif
|
||||
inline void msg_get(USHORT number, TEXT* msg);
|
||||
@ -88,7 +88,7 @@ void inline gsec_exit(int code, tsec* tdsec)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
THREAD_ENTRY_DECLARE GSEC_main(THREAD_ENTRY_PARAM arg)
|
||||
{
|
||||
/**********************************************
|
||||
@ -159,7 +159,7 @@ inline void envPick(TEXT* dest, size_t size, const TEXT* var)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SUPERSERVER */
|
||||
#endif /* SERVICE_THREAD */
|
||||
|
||||
int common_main(int argc,
|
||||
char* argv[],
|
||||
@ -207,7 +207,7 @@ int common_main(int argc,
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
|
||||
tdsec->tsec_service_gsec = true;
|
||||
tdsec->tsec_service_thd = true;
|
||||
@ -299,10 +299,10 @@ int common_main(int argc,
|
||||
isc_svc_handle sHandle = 0;
|
||||
if (useServices)
|
||||
{
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
envPick(user_data->dba_user_name, sizeof user_data->dba_user_name, "ISC_USER");
|
||||
envPick(user_data->dba_password, sizeof user_data->dba_password, "ISC_PASSWORD");
|
||||
#endif //SUPERSERVER
|
||||
#endif //SERVICE_THREAD
|
||||
sHandle = attachRemoteServiceManager(
|
||||
status,
|
||||
user_data->dba_user_name,
|
||||
@ -316,7 +316,7 @@ int common_main(int argc,
|
||||
|
||||
if (!tdsec->tsec_interactive) {
|
||||
if (ret == 0) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
/* Signal the start of the service here ONLY if we are displaying users
|
||||
* since the number of users may exceed the service buffer. This
|
||||
* will cause the service to wait for the client to request data. However,
|
||||
@ -434,7 +434,7 @@ static void data_print(void* arg, const internal_user_data* data, bool first)
|
||||
**************************************/
|
||||
tsec* tdsec = tsec::getSpecific();
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#define STUFF_USER(item) SVC_putc(tdsec->tsec_service_blk, item)
|
||||
#else
|
||||
#define STUFF_USER(item) fputc(item, stderr)
|
||||
@ -612,7 +612,7 @@ static bool get_switches(
|
||||
for (l = 0; l < 32 && string[l] && string[l] != ' '; l++)
|
||||
user_data->user_name[l] = UPPER(string[l]);
|
||||
if (l == 32) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
GSEC_error(GsecMsg76, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
GSEC_print(GsecMsg76, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -679,7 +679,7 @@ static bool get_switches(
|
||||
break;
|
||||
case IN_SW_GSEC_Z:
|
||||
case IN_SW_GSEC_0:
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
GSEC_error(GsecMsg29, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
GSEC_print(GsecMsg29, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -893,7 +893,7 @@ static bool get_switches(
|
||||
tdsec->tsec_sw_version = true;
|
||||
break;
|
||||
case IN_SW_GSEC_0:
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
GSEC_error(GsecMsg40, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
GSEC_print(GsecMsg40, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -901,7 +901,7 @@ static bool get_switches(
|
||||
/* gsec - invalid switch specified */
|
||||
return false;
|
||||
case IN_SW_GSEC_AMBIG:
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
GSEC_error(GsecMsg41, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
GSEC_print(GsecMsg41, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -1136,7 +1136,7 @@ static SSHORT parse_cmd_line(int argc, const TEXT* const* argv, tsec* tdsec)
|
||||
|
||||
SSHORT ret = 0;
|
||||
if (!get_switches(argc, argv, gsec_in_sw_table, tdsec, &quitflag)) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
GSEC_error(GsecMsg16, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
GSEC_print(GsecMsg16, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -1182,7 +1182,7 @@ void GSEC_print_status(const ISC_STATUS* status_vector)
|
||||
**************************************/
|
||||
if (status_vector) {
|
||||
const ISC_STATUS* vector = status_vector;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
tsec* tdsec = tsec::getSpecific();
|
||||
ISC_STATUS* status = tdsec->tsec_service_blk->svc_status;
|
||||
if (status != status_vector) {
|
||||
@ -1273,7 +1273,7 @@ void GSEC_error(
|
||||
* Format and print an error message, then punt.
|
||||
*
|
||||
**************************************/
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
tsec* tdsec = tsec::getSpecific();
|
||||
ISC_STATUS* status = tdsec->tsec_service_blk->svc_status;
|
||||
|
||||
|
@ -102,7 +102,7 @@ struct internal_user_data {
|
||||
|
||||
};
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
class tsec;
|
||||
extern tsec* gdsec;
|
||||
#endif
|
||||
@ -139,7 +139,7 @@ public:
|
||||
Jrd::Service* tsec_output_data;
|
||||
FILE* tsec_output_file;
|
||||
Jrd::Service* tsec_service_blk;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static inline tsec* getSpecific() {
|
||||
return (tsec*) ThreadData::getSpecific();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "../jrd/thd.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef MULTI_THREAD
|
||||
THREAD_ENTRY_DECLARE GSEC_main(THREAD_ENTRY_PARAM);
|
||||
#endif
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "../jrd/license.h"
|
||||
#include "../jrd/msg_encode.h"
|
||||
#include "../jrd/gdsassert.h"
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
#include "../utilities/gstat/ppg_proto.h"
|
||||
#endif
|
||||
#include "../utilities/gstat/dbaswi.h"
|
||||
@ -54,7 +54,7 @@
|
||||
#include "../jrd/isc_f_proto.h"
|
||||
#include "../jrd/thd.h"
|
||||
#include "../jrd/enc_proto.h"
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include "../utilities/common/cmd_util_proto.h"
|
||||
#endif
|
||||
#include "../common/utils_proto.h"
|
||||
@ -146,7 +146,7 @@ static void db_error(int);
|
||||
|
||||
static dba_fil* db_open(const char*, USHORT);
|
||||
static const pag* db_read(SLONG);
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static void db_close(int);
|
||||
#endif
|
||||
static void move(const SCHAR*, SCHAR*, SSHORT);
|
||||
@ -164,7 +164,7 @@ static void dba_print(USHORT, const TEXT*, const TEXT*, const TEXT*,
|
||||
#include "../jrd/svc.h"
|
||||
#include "../jrd/svc_proto.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#include <fcntl.h>
|
||||
#if (defined WIN_NT)
|
||||
#include <share.h>
|
||||
@ -192,7 +192,7 @@ struct dba_mem {
|
||||
|
||||
/* threading declarations for thread data */
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
#ifndef SERVICE_THREAD
|
||||
class tdba;
|
||||
static tdba* gddba;
|
||||
#endif
|
||||
@ -212,7 +212,7 @@ public:
|
||||
buffer2 = 0;
|
||||
global_buffer = 0;
|
||||
exit_code = 0;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
sw_outfile = 0;
|
||||
head_of_mem_list = 0;
|
||||
head_of_files_list = 0;
|
||||
@ -233,7 +233,7 @@ public:
|
||||
pag* buffer2;
|
||||
pag* global_buffer;
|
||||
int exit_code;
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
Jrd::Service* sw_outfile;
|
||||
dba_mem *head_of_mem_list;
|
||||
open_files *head_of_files_list;
|
||||
@ -244,7 +244,7 @@ public:
|
||||
ISC_STATUS *dba_status;
|
||||
ISC_STATUS_ARRAY dba_status_vector;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static inline tdba* getSpecific() {
|
||||
return (tdba*) ThreadData::getSpecific();
|
||||
}
|
||||
@ -288,7 +288,7 @@ const USHORT GSTAT_MSG_FAC = 21;
|
||||
|
||||
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
THREAD_ENTRY_DECLARE main_gstat(THREAD_ENTRY_PARAM arg)
|
||||
#else
|
||||
|
||||
@ -326,7 +326,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
tdba::putSpecific(tddba, &thd_context);
|
||||
tddba->dba_env = (UCHAR *) env;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
/* Reinitialize static variables for multi-threading */
|
||||
Jrd::Service* service = (Jrd::Service*)arg;
|
||||
int argc = service->svc_argc;
|
||||
@ -337,13 +337,13 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
|
||||
try {
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
Jrd::Service* sw_outfile = tddba->sw_outfile = service;
|
||||
#else
|
||||
FILE* sw_outfile = tddba->sw_outfile = stdout;
|
||||
#endif
|
||||
|
||||
#if defined (WIN95) && !defined (SUPERSERVER)
|
||||
#if defined (WIN95) && !defined (SERVICE_THREAD)
|
||||
bool fAnsiCP = false;
|
||||
#endif
|
||||
|
||||
@ -360,7 +360,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
else if (!strcmp(argv[1], "-svc_thd")) {
|
||||
called_as_service = true;
|
||||
tddba->dba_service_blk = service;
|
||||
@ -375,7 +375,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
long redir_out = atol(argv[3]);
|
||||
long redir_err = atol(argv[4]);
|
||||
#ifdef WIN_NT
|
||||
#if defined (WIN95) && !defined (SUPERSERVER)
|
||||
#if defined (WIN95) && !defined (SERVICE_THREAD)
|
||||
fAnsiCP = true;
|
||||
#endif
|
||||
redir_in = _open_osfhandle(redir_in, 0);
|
||||
@ -432,7 +432,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
if (in_sw_tab->in_sw_msg)
|
||||
dba_print(in_sw_tab->in_sw_msg, 0, 0, 0, 0, 0);
|
||||
}
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 1,
|
||||
0, NULL,
|
||||
@ -504,7 +504,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
dba_print(5, GDS_VERSION, 0, 0, 0, 0); /* msg 5: gstat version %s */
|
||||
|
||||
if (!name) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 2,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -518,7 +518,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
if (sw_record && !sw_data)
|
||||
sw_data = true;
|
||||
|
||||
#if defined (WIN95) && !defined (SUPERSERVER)
|
||||
#if defined (WIN95) && !defined (SERVICE_THREAD)
|
||||
if (!fAnsiCP) {
|
||||
const ULONG ulConsoleCP = GetConsoleCP();
|
||||
if (ulConsoleCP == GetACP())
|
||||
@ -544,13 +544,13 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
tddba->page_number = -1;
|
||||
const header_page* header = (const header_page*) db_read((SLONG) 0);
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
service->svc_started();
|
||||
#endif
|
||||
|
||||
if (!ODS_SUPPORTED(header->hdr_ods_version, header->hdr_ods_minor))
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 3,
|
||||
isc_arg_number, (void*)(IPTR) ODS_VERSION,
|
||||
@ -562,7 +562,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
}
|
||||
|
||||
char file_name[1024];
|
||||
#if defined (WIN95) && !defined (SUPERSERVER)
|
||||
#if defined (WIN95) && !defined (SERVICE_THREAD)
|
||||
if (!fAnsiCP)
|
||||
AnsiToOem(name, file_name);
|
||||
else
|
||||
@ -595,7 +595,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
if (*vp == HDR_file) {
|
||||
memcpy(file_name, vp + 2, vp[1]);
|
||||
*(file_name + vp[1]) = '\0';
|
||||
#if defined (WIN95) && !defined (SUPERSERVER)
|
||||
#if defined (WIN95) && !defined (SERVICE_THREAD)
|
||||
if (!fAnsiCP)
|
||||
AnsiToOem(file_name, file_name);
|
||||
#endif
|
||||
@ -875,7 +875,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
|
||||
if (status_vector[1])
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
ISC_STATUS* status = tddba->dba_service_blk->svc_status;
|
||||
if (status != status_vector)
|
||||
{
|
||||
@ -907,7 +907,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
*/
|
||||
FINISH;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
service->svc_started();
|
||||
dba_mem* alloced = tddba->head_of_mem_list;
|
||||
while (alloced != 0) {
|
||||
@ -946,7 +946,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
int exit_code = tddba->exit_code;
|
||||
tdba::restoreSpecific();
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
return (THREAD_ENTRY_RETURN)(exit_code);
|
||||
#else
|
||||
exit(exit_code);
|
||||
@ -969,7 +969,7 @@ static char* alloc(size_t size)
|
||||
* Allocate and zero a piece of memory.
|
||||
*
|
||||
**************************************/
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
tdba* tddba = tdba::getSpecific();
|
||||
char* const block = FB_NEW(*getDefaultMemoryPool()) SCHAR[size];
|
||||
#else
|
||||
@ -985,7 +985,7 @@ static char* alloc(size_t size)
|
||||
*p++ = 0;
|
||||
} while (--size);
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
dba_mem* mem_list = FB_NEW(*getDefaultMemoryPool()) dba_mem;
|
||||
if (!mem_list) {
|
||||
/* NOMEM: return error */
|
||||
@ -1321,7 +1321,7 @@ static ULONG analyze_versions( dba_rel* relation, const rhdf* header)
|
||||
|
||||
|
||||
#ifdef WIN_NT
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static void db_close( int file_desc)
|
||||
{
|
||||
/**************************************
|
||||
@ -1418,7 +1418,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
|
||||
if (fil->fil_desc == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 29,
|
||||
isc_arg_string, file_name,
|
||||
@ -1428,7 +1428,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
db_error(GetLastError());
|
||||
}
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
open_files* file_list = FB_NEW(*getDefaultMemoryPool()) open_files;
|
||||
if (!file_list) {
|
||||
/* NOMEM: return error */
|
||||
@ -1484,7 +1484,7 @@ static const pag* db_read( SLONG page_number)
|
||||
(fil->fil_desc, (LONG) liOffset.LowPart, &liOffset.HighPart,
|
||||
FILE_BEGIN) == (DWORD) -1)
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 30,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -1500,7 +1500,7 @@ static const pag* db_read( SLONG page_number)
|
||||
reinterpret_cast<LPDWORD>(&actual_length),
|
||||
NULL))
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 30,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -1509,7 +1509,7 @@ static const pag* db_read( SLONG page_number)
|
||||
db_error(GetLastError());
|
||||
}
|
||||
if (actual_length != tddba->page_size) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 4,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -1524,7 +1524,7 @@ static const pag* db_read( SLONG page_number)
|
||||
|
||||
|
||||
#ifndef WIN_NT
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
static void db_close( int file_desc)
|
||||
{
|
||||
/**************************************
|
||||
@ -1617,7 +1617,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
|
||||
if ((fil->fil_desc = open(file_name, O_RDONLY)) == -1)
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 29,
|
||||
isc_arg_string, file_name,
|
||||
@ -1627,7 +1627,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
db_error(errno);
|
||||
}
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
open_files* file_list = FB_NEW(*getDefaultMemoryPool()) open_files;
|
||||
if (!file_list) {
|
||||
/* NOMEM: return error */
|
||||
@ -1677,7 +1677,7 @@ static const pag* db_read( SLONG page_number)
|
||||
page_number -= fil->fil_min_page - fil->fil_fudge;
|
||||
const UINT64 offset = ((UINT64)page_number) * ((UINT64)tddba->page_size);
|
||||
if (lseek (fil->fil_desc, offset, 0) == -1) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 30,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -1691,7 +1691,7 @@ static const pag* db_read( SLONG page_number)
|
||||
{
|
||||
const SSHORT l = read(fil->fil_desc, p, length);
|
||||
if (l < 0) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 30,
|
||||
0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||
@ -1700,7 +1700,7 @@ static const pag* db_read( SLONG page_number)
|
||||
db_error(errno);
|
||||
}
|
||||
if (!l) {
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
GSTAT_MSG_FAC, 4,
|
||||
0, NULL,
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "../jrd/nbak.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
#ifndef INCLUDE_FB_BLK
|
||||
#include "../include/fb_blk.h"
|
||||
#endif
|
||||
@ -56,7 +56,7 @@
|
||||
using namespace Ods;
|
||||
|
||||
void PPG_print_header(const header_page* header, SLONG page, bool nocreation,
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
Jrd::Service* outfile)
|
||||
#else
|
||||
FILE* outfile)
|
||||
@ -287,7 +287,7 @@ void PPG_print_header(const header_page* header, SLONG page, bool nocreation,
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
void PPG_print_log(const log_info_page* logp, SLONG page, bool nocreation,
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
Jrd::Service* outfile)
|
||||
#else
|
||||
FILE* outfile)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef UTILITIES_PPG_PROTO_H
|
||||
#define UTILITIES_PPG_PROTO_H
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#ifdef SERVICE_THREAD
|
||||
void PPG_print_header (const Ods::header_page*, SLONG, bool, Jrd::Service*);
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
void PPG_print_log (const Ods::log_info_page*, SLONG, bool, Jrd::Service*);
|
||||
|
Loading…
Reference in New Issue
Block a user