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

-Replace define with const

-Move SYS_ERR, ERRNO, H_ERRNO and INET_ERRNO(ERRNO in inet.cpp) macros to common.h
-Remove unused macros
This commit is contained in:
brodsom 2004-05-05 21:55:13 +00:00
parent a374716635
commit 80b424e346
23 changed files with 132 additions and 251 deletions

View File

@ -49,7 +49,7 @@
*
*/
/*
$Id: common.h,v 1.112 2004-05-04 19:16:43 brodsom Exp $
$Id: common.h,v 1.113 2004-05-05 21:53:37 brodsom Exp $
*/
#ifndef JRD_COMMON_H
@ -505,6 +505,7 @@ static inline int sinixz_sigaction(int sig, const struct sinixz_sigaction *act,
#define NO_CHECKSUM
#define ISC_EXT_LIB_PATH_ENV "interbase_ext_lib_path:"
#define SYS_ARG isc_arg_vms
#define SYS_ERR isc_arg_vms
#if __ALPHA
#define IMPLEMENTATION isc_info_db_impl_alpha_vms /* 53 */
@ -580,6 +581,7 @@ typedef unsigned int64 UATOM;
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define SYS_ARG isc_arg_win32
#define SYS_ERR isc_arg_win32
/*#define SLONGFORMAT "ld"
#define ULONGFORMAT "lu"
#define XLONGFORMAT "lX"
@ -632,6 +634,10 @@ typedef unsigned __int64 UINT64;
#endif
#endif
#define ERRNO GetLastError()
#define INET_ERRNO WSAGetLastError()
#define H_ERRNO WSAGetLastError()
#endif /* WIN_NT */
// 23 Sep 2002, skidder, ALLOC_LIB_MEMORY moved here,
@ -676,8 +682,24 @@ typedef unsigned __int64 UINT64;
#ifdef UNIX
#define NO_CHECKSUM
#define SYS_ARG isc_arg_unix
#define SYS_ERR isc_arg_unix
#endif /* UNIX */
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
#ifndef ERRNO
#define ERRNO errno
#endif
#ifndef INET_ERRNO
#define INET_ERRNO errno
#endif
#ifndef H_ERRNO
#define H_ERRNO h_errno
#endif
/* various declaration modifiers */

View File

@ -85,10 +85,6 @@ using namespace Jrd;
typedef Firebird::Array<TEXT*> TextStack;
#ifdef SUPERSERVER
#define V4_THREADING
#endif
const int FOR_KEY_UPD_CASCADE = 0x01;
const int FOR_KEY_UPD_NULL = 0x02;
const int FOR_KEY_UPD_DEFAULT = 0x04;

View File

@ -64,10 +64,6 @@
using namespace Jrd;
#ifdef SUPERSERVER
#define V4_THREADING
#endif
DATABASE DB = STATIC "ODS.RDB";
static bool delete_constraint_records(Global*, const TEXT*, const TEXT*);

View File

@ -76,10 +76,6 @@
using namespace Jrd;
#ifdef SUPERSERVER
#define V4_THREADING
#endif
DATABASE DB = STATIC "ODS.RDB";
const int MAX_CHARS_SHORT = 6; /* 2**16 = 5 chars + sign */

View File

@ -60,10 +60,6 @@
using namespace Jrd;
#ifdef SUPERSERVER
#define V4_THREADING
#endif
DATABASE DB = STATIC "ODS.RDB";
static const SCHAR gen_id_blr1[] = {

View File

@ -91,22 +91,13 @@ namespace {
}
#ifdef WIN_NT
#define FOPEN_TYPE "a+b"
#define FOPEN_READ_ONLY "rb"
#define SYS_ERR isc_arg_win32
static const char* FOPEN_TYPE = "a+b";
static const char* FOPEN_READ_ONLY = "rb";
#else
static const char* FOPEN_TYPE = "a+";
static const char* FOPEN_READ_ONLY = "rb";
#endif
#ifndef FOPEN_TYPE
#define FOPEN_TYPE "a+"
#define FOPEN_READ_ONLY "rb"
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
void EXT_close(RecordSource* rsb)
{
/**************************************

View File

@ -26,31 +26,31 @@
/* flags for RDB$FILE_FLAGS */
#define FILE_shadow 1
#define FILE_inactive 2
#define FILE_manual 4
#define FILE_cache 8
#define FILE_conditional 16
const USHORT FILE_shadow = 1;
const USHORT FILE_inactive = 2;
const USHORT FILE_manual = 4;
const USHORT FILE_cache = 8;
const USHORT FILE_conditional = 16;
/* Flags for backup difference files */
// File is difference
#define FILE_difference 32
const USHORT FILE_difference = 32;
// Actively used for backup purposes (ALTER DATABASE BEGIN BACKUP issued)
#define FILE_backing_up 64
const USHORT FILE_backing_up = 64;
/* flags for RDB$LOG_FILES */
#define LOG_serial 1
#define LOG_default 2
#define LOG_raw 4
#define LOG_overflow 8
const USHORT LOG_serial = 1;
const USHORT LOG_default = 2;
const USHORT LOG_raw = 4;
const USHORT LOG_overflow = 8;
/* flags for RDB$RELATIONS */
#define REL_sql 1
const USHORT REL_sql = 1;
/* flags for RDB$TRIGGERS */
#define TRG_sql 0x1
#define TRG_ignore_perm 0x2 /* trigger ignores permissions checks */
const USHORT TRG_sql = 0x1;
const USHORT TRG_ignore_perm = 0x2; /* trigger ignores permissions checks */
#endif /* JRD_FLAGS_H */

View File

@ -36,7 +36,7 @@
*
*/
/*
$Id: isc.cpp,v 1.48 2004-05-02 23:05:00 skidder Exp $
$Id: isc.cpp,v 1.49 2004-05-05 21:53:37 brodsom Exp $
*/
#ifdef DARWIN
#define _STLP_CCTYPE
@ -155,16 +155,6 @@ static void poke_ast(POKE);
static int wait_test(SSHORT *);
#endif
#ifndef MAXHOSTLEN
#define MAXHOSTLEN 64
#endif
#ifndef FOPEN_READ_TYPE
#define FOPEN_READ_TYPE "r"
#define FOPEN_WRITE_TYPE "w"
#endif
#ifndef REQUESTER
void ISC_ast_enter(void)
{
@ -220,20 +210,14 @@ bool ISC_check_process_existence(SLONG pid,
**************************************/
#if defined(UNIX)
#define CHECK_EXIST
return (kill((int) pid, 0) == -1 &&
(errno == ESRCH
|| (super_user && errno == EPERM)) ? false : true);
#endif
#ifdef VMS
#define CHECK_EXIST
#elif defined(VMS)
ULONG item = JPI$_PID;
return (lib$getjpi(&item, &pid, NULL, NULL, NULL, NULL) == SS$_NONEXPR) ?
false : true;
#endif
#ifdef WIN_NT
#elif defined(WIN_NT)
HANDLE handle = OpenProcess(PROCESS_DUP_HANDLE, FALSE, (DWORD) pid);
if (!handle && GetLastError() != ERROR_ACCESS_DENIED)
@ -242,12 +226,9 @@ bool ISC_check_process_existence(SLONG pid,
}
CloseHandle(handle);
#endif
#ifndef CHECK_EXIST
return true;
#else
#undef CHECK_EXIST
return true;
#endif
}
@ -301,7 +282,6 @@ int ISC_expand_logical_once(const TEXT* file_name,
#if (defined SOLARIS || defined SCO_EV)
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
@ -323,11 +303,9 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
return string;
}
#endif
#elif defined (VMS)
#ifdef VMS
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
@ -356,11 +334,9 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
return string;
}
#endif
#elif defined(WIN_NT)
#ifdef WIN_NT
#define GET_HOST
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************
@ -387,9 +363,9 @@ TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
return string;
}
#endif
#ifndef GET_HOST
#else
TEXT *INTERNAL_API_ROUTINE ISC_get_host(TEXT* string, USHORT length)
{
/**************************************

View File

@ -207,10 +207,6 @@ static void make_object_name(TEXT*, const TEXT*, const TEXT*);
#endif
#endif
#ifndef SV_INTERRUPT
#define SV_INTERRUPT 0
#endif
#if defined FREEBSD || defined NETBSD || defined DARWIN
#define sigset signal

View File

@ -283,16 +283,6 @@ void Jrd::Trigger::release(thread_db* tdbb)
return; // TRUE;
}
#ifdef WIN_NT
#define SYS_ERR isc_arg_win32
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
/* Option block for database parameter block */
typedef struct dpb

View File

@ -141,8 +141,8 @@ void jrd_vtof(const char*, char*, SSHORT);
#ifdef SERVER_SHUTDOWN
/* Defines for paramater 3 of JRD_num_attachments */
#define JRD_info_drivemask 1
#define JRD_info_dbnames 2
const USHORT JRD_info_drivemask = 1;
const USHORT JRD_info_dbnames = 2;
TEXT* JRD_num_attachments(TEXT* const, USHORT, USHORT, USHORT*, USHORT*);
ULONG JRD_shutdown_all();

View File

@ -31,8 +31,8 @@
#include "../jrd/smp_impl.h"
#include "../jrd/thd.h"
#define MAX_PASSWORD_ENC_LENGTH 12
#define PASSWORD_SALT "9z"
const int MAX_PASSWORD_ENC_LENGTH = 12;
static const char* PASSWORD_SALT = "9z";
class SecurityDatabase
{
@ -78,9 +78,9 @@ private:
};
#ifdef VMS
#define USER_INFO_NAME "[sysmgr]security.fdb"
static const char* USER_INFO_NAME = "[sysmgr]security.fdb";
#else
#define USER_INFO_NAME "security.fdb"
static const char* USER_INFO_NAME = "security.fdb";
#endif
#endif /* JRD_PWD_H */

View File

@ -49,12 +49,12 @@
#endif
/* This is the number of seconds in a day */
#define ONE_DAY 86400
//#define ONE_DAY 86400
/* MIN_YEAR and MAX_YEAR delimit the range for valid years
* when either inserting data or performing date arithmetic
*/
#define MIN_YEAR 0001
#define MAX_YEAR 9999
const int MIN_YEAR = 0001;
const int MAX_YEAR = 9999;
#endif /* JRD_TIME_H */

View File

@ -29,13 +29,13 @@
/* The following definitions can be used to specify the context in
* which a status code is used.
*/
#define CLASS_ERROR 0L /* Code represents an error */
#define CLASS_WARNING 1L /* Code represents a warning */
#define CLASS_INFO 2L /* Code represents an information msg */
//#define CLASS_ERROR 0L /* Code represents an error */
//#define CLASS_WARNING 1L /* Code represents a warning */
//#define CLASS_INFO 2L /* Code represents an information msg */
#define MAKE_ERROR(code) (code | (CLASS_ERROR & 0x3L) << 30)
#define MAKE_WARNING(code) (code | (CLASS_WARNING & 0x3L) << 30)
#define MAKE_INFO(code) (code | (CLASS_INFO & 0x3L) << 30)
//#define MAKE_ERROR(code) (code | (CLASS_ERROR & 0x3L) << 30)
//#define MAKE_WARNING(code) (code | (CLASS_WARNING & 0x3L) << 30)
//#define MAKE_INFO(code) (code | (CLASS_INFO & 0x3L) << 30)
/* The procedure for encoding an error message is as follows:
* Be sure to update gds.c::gds__decode if this calculation changes

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: sort.cpp,v 1.62 2004-05-03 22:42:46 brodsom Exp $
* $Id: sort.cpp,v 1.63 2004-05-05 21:53:36 brodsom Exp $
*
* 2001-09-24 SJL - Temporary fix for large sort file bug
*
@ -157,15 +157,6 @@ FILE *trace_file = NULL;
#define SCRATCH "fb_sort_"
#endif
#ifdef WIN_NT
#define SYS_ERR isc_arg_win32
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
#ifdef SCROLLABLE_CURSORS
#ifdef WORDS_BIGENDIAN
void SORT_diddle_key(UCHAR* record, sort_context* scb, bool direction)

View File

@ -117,12 +117,6 @@ const int SVC_user_none = 0;
# include <stdlib.h>
# include <fcntl.h>
# include <sys/stat.h>
# define SYS_ERR isc_arg_win32
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
#ifdef VMS

View File

@ -25,24 +25,24 @@
#define SVC_UNDOC_H
/* Service Action Flags */
#define isc_action_svc_lock_stats 13 /* Retrieves lock manager statistics */
#define isc_action_svc_set_config 14 /* Sets configuration file values */
#define isc_action_svc_default_config 15 /* Sets the configuration options to their default values */
#define isc_action_svc_set_env 16 /* Sets the value for $INTERBASE */
#define isc_action_svc_set_env_lock 17 /* Sets the value for $INTERBASE_LOCK */
#define isc_action_svc_set_env_msg 18 /* Sets the value for $INTERBASE_MSG */
const int isc_action_svc_lock_stats = 13; /* Retrieves lock manager statistics */
const int isc_action_svc_set_config = 14; /* Sets configuration file values */
const int isc_action_svc_default_config = 15; /* Sets the configuration options to their default values */
const int isc_action_svc_set_env = 16; /* Sets the value for $INTERBASE */
const int isc_action_svc_set_env_lock = 17; /* Sets the value for $INTERBASE_LOCK */
const int isc_action_svc_set_env_msg = 18; /* Sets the value for $INTERBASE_MSG */
/* Service Info Flags */
#define isc_info_svc_total_length 69
#define isc_info_svc_response 70
#define isc_info_svc_response_more 71
#define isc_info_svc_message 72
#define isc_info_svc_svr_online 73
#define isc_info_svc_svr_offline 74
#define isc_info_svc_set_config 75
#define isc_info_svc_default_config 76
#define isc_info_svc_dump_pool_info 77
const int isc_info_svc_total_length = 69;
const int isc_info_svc_response = 70;
const int isc_info_svc_response_more = 71;
const int isc_info_svc_message = 72;
const int isc_info_svc_svr_online = 73;
const int isc_info_svc_svr_offline = 74;
const int isc_info_svc_set_config = 75;
const int isc_info_svc_default_config = 76;
const int isc_info_svc_dump_pool_info = 77;
// BRS: Is not strange the following parameters are undocumented
// it are also unused in the code

View File

@ -97,37 +97,26 @@
#ifdef VMS
#ifdef __ALPHA
#define EDT_IMAGE "TPUSHR"
#define EDT_SYMBOL "TPU$EDIT"
static const char* EDT_IMAGE = "TPUSHR";
static const char* EDT_SYMBOL = "TPU$EDIT";
#else
#define EDT_IMAGE "EDTSHR"
#define EDT_SYMBOL "EDT$EDIT"
static const char* EDT_IMAGE = "EDTSHR";
static const char* EDT_SYMBOL = "EDT$EDIT";
#endif
#endif
/* Bug 7119 - BLOB_load will open external file for read in BINARY mode. */
#ifdef WIN_NT
#define FOPEN_READ_TYPE "rb"
#define FOPEN_WRITE_TYPE "wb"
#define FOPEN_READ_TYPE_TEXT "rt"
#define FOPEN_WRITE_TYPE_TEXT "wt"
#endif
#ifndef FOPEN_READ_TYPE
#define FOPEN_READ_TYPE "r"
#endif
#ifndef FOPEN_WRITE_TYPE
#define FOPEN_WRITE_TYPE "w"
#endif
#ifndef FOPEN_READ_TYPE_TEXT
#define FOPEN_READ_TYPE_TEXT FOPEN_READ_TYPE
#endif
#ifndef FOPEN_WRITE_TYPE_TEXT
#define FOPEN_WRITE_TYPE_TEXT FOPEN_WRITE_TYPE
static const char* FOPEN_READ_TYPE = "rb";
static const char* FOPEN_WRITE_TYPE = "wb";
static const char* FOPEN_READ_TYPE_TEXT = "rt";
static const char* FOPEN_WRITE_TYPE_TEXT= "wt";
#else
static const char* FOPEN_READ_TYPE = "r";
static const char* FOPEN_WRITE_TYPE = "w";
static const char* FOPEN_READ_TYPE_TEXT = FOPEN_READ_TYPE;
static const char* FOPEN_WRITE_TYPE_TEXT= FOPEN_WRITE_TYPE;
#endif
#define LOWER7(c) ( (c >= 'A' && c<= 'Z') ? c + 'a' - 'A': c )

View File

@ -39,7 +39,7 @@
*/
/*
$Id: lock.cpp,v 1.92 2004-05-04 15:57:56 brodsom Exp $
$Id: lock.cpp,v 1.93 2004-05-05 21:54:17 brodsom Exp $
*/
#include "firebird.h"
@ -101,7 +101,6 @@ $Id: lock.cpp,v 1.92 2004-05-04 15:57:56 brodsom Exp $
#ifdef WIN_NT
#include <process.h>
#define MUTEX lock_manager_mutex
#define ERRNO GetLastError()
#endif
#ifdef MANAGER_PROCESS
@ -177,18 +176,10 @@ SSHORT LOCK_debug_level = 0;
#define DEBUG_DELAY /* nothing */
#endif
#ifndef ERRNO
#define ERRNO errno
#endif
#ifndef MUTEX
#define MUTEX LOCK_header->lhb_mutex
#endif
#ifndef SV_INTERRUPT
#define SV_INTERRUPT 0
#endif
#define DUMMY_OWNER_CREATE ((SRQ_PTR) -1)
#define DUMMY_OWNER_DELETE ((SRQ_PTR) -2)
#define DUMMY_OWNER_SHUTDOWN ((SRQ_PTR) -3)

View File

@ -41,7 +41,7 @@
*
*/
/*
$Id: inet.cpp,v 1.102 2004-05-02 23:06:05 skidder Exp $
$Id: inet.cpp,v 1.103 2004-05-05 21:54:55 brodsom Exp $
*/
#include "firebird.h"
#include <stdio.h>
@ -137,10 +137,7 @@ extern int h_errno;
#include <process.h>
#include <signal.h>
#include "../utilities/install/install_nt.h"
#define ERRNO WSAGetLastError()
#define H_ERRNO WSAGetLastError()
#define SOCLOSE closesocket
#define SYS_ERR isc_arg_win32
#define INET_RETRY_ERRNO WSAEINPROGRESS
#define INET_ADDR_IN_USE WSAEADDRINUSE
#define sleep(seconds) Sleep ((seconds) * 1000)
@ -153,8 +150,6 @@ extern int h_errno;
# ifndef SOCKET
# define SOCKET SOCKET
# endif /* SOCKET */
#define ERRNO WSAGetLastError()
#define H_ERRNO WSAGetLastError()
#endif /* WIN_NT */
@ -162,14 +157,6 @@ extern int h_errno;
#define NO_ITIMER
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_unix
#endif
#ifndef SV_INTERRUPT
#define SV_INTERRUPT 0
#endif
#ifndef EINTR
#define EINTR 0
#endif
@ -190,10 +177,6 @@ extern int h_errno;
#define SOCLOSE close
#endif
#ifndef ERRNO
#define ERRNO errno
#endif
#ifndef INET_ADDR_IN_USE
#define INET_ADDR_IN_USE EADDRINUSE
#endif
@ -206,10 +189,6 @@ extern int h_errno;
#define INET_RETRY_CALL 5
#endif
#ifndef H_ERRNO
#define H_ERRNO h_errno
#endif
#ifndef SIGURG
#define SIGURG SIGINT
#endif
@ -921,7 +900,7 @@ rem_port* INET_connect(const TEXT* name,
if ((SOCKET) port->port_handle == INVALID_SOCKET)
{
inet_error(port, "socket", isc_net_connect_err, ERRNO);
inet_error(port, "socket", isc_net_connect_err, INET_ERRNO);
disconnect(port);
return NULL;
}
@ -938,7 +917,7 @@ rem_port* INET_connect(const TEXT* name,
if (n != -1 && send_full(port, packet))
return port;
else {
inet_error(port, "connect", isc_net_connect_err, ERRNO);
inet_error(port, "connect", isc_net_connect_err, INET_ERRNO);
disconnect(port);
return NULL;
}
@ -958,7 +937,7 @@ rem_port* INET_connect(const TEXT* name,
(SCHAR*) &optval, sizeof(optval));
if (n == -1) {
inet_error(port, "setsockopt REUSE", isc_net_connect_listen_err,
ERRNO);
INET_ERRNO);
disconnect(port);
return NULL;
}
@ -977,7 +956,7 @@ rem_port* INET_connect(const TEXT* name,
(SCHAR *) & lingerInfo, sizeof(lingerInfo));
if (n == -1) {
inet_error(port, "setsockopt LINGER", isc_net_connect_listen_err,
ERRNO);
INET_ERRNO);
disconnect(port);
return NULL;
}
@ -994,7 +973,7 @@ rem_port* INET_connect(const TEXT* name,
if (n == -1) {
inet_error(port, "setsockopt TCP_NODELAY",
isc_net_connect_listen_err, ERRNO);
isc_net_connect_listen_err, INET_ERRNO);
disconnect(port);
return NULL;
}
@ -1010,7 +989,7 @@ rem_port* INET_connect(const TEXT* name,
/* On Linux platform, when the server dies the system holds a port
for some time. */
if (ERRNO == INET_ADDR_IN_USE) {
if (INET_ERRNO == INET_ADDR_IN_USE) {
for (int retry = 0; retry < INET_RETRY_CALL; retry++) {
sleep(10);
n = bind((SOCKET) port->port_handle,
@ -1020,7 +999,7 @@ rem_port* INET_connect(const TEXT* name,
}
}
else {
inet_error(port, "bind", isc_net_connect_listen_err, ERRNO);
inet_error(port, "bind", isc_net_connect_listen_err, INET_ERRNO);
disconnect(port);
return NULL;
}
@ -1029,7 +1008,7 @@ rem_port* INET_connect(const TEXT* name,
n = listen((SOCKET) port->port_handle, 5);
if (n == -1) {
inet_error(port, "listen", isc_net_connect_listen_err, ERRNO);
inet_error(port, "listen", isc_net_connect_listen_err, INET_ERRNO);
return NULL;
}
@ -1051,7 +1030,7 @@ rem_port* INET_connect(const TEXT* name,
(struct sockaddr *) &address, &l);
if (s == INVALID_SOCKET) {
THREAD_ENTER;
inet_error(port, "accept", isc_net_connect_err, ERRNO);
inet_error(port, "accept", isc_net_connect_err, INET_ERRNO);
disconnect(port);
return NULL;
}
@ -1342,7 +1321,7 @@ static int accept_connection(rem_port* port,
if (home) {
if (chdir(home)) {
gds__log("inet_server: unable to cd to %s errno %d\n", home,
ERRNO);
INET_ERRNO);
/* We continue after the error */
}
}
@ -1397,11 +1376,11 @@ static rem_port* alloc_port( rem_port* parent)
const WORD version = MAKEWORD(2, 0);
if (WSAStartup(version, &INET_wsadata)) {
if (parent)
inet_error(parent, "WSAStartup", isc_net_init_error, ERRNO);
inet_error(parent, "WSAStartup", isc_net_init_error, INET_ERRNO);
else {
sprintf(buffer,
"INET/alloc_port: WSAStartup failed, error code = %d",
ERRNO);
INET_ERRNO);
gds__log(buffer, 0);
}
return NULL;
@ -1501,7 +1480,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast)
socklen_t l = sizeof(address);
SOCKET n = accept(port->port_channel, (struct sockaddr *) &address, &l);
if (n == INVALID_SOCKET) {
inet_error(port, "accept", isc_net_event_connect_err, ERRNO);
inet_error(port, "accept", isc_net_event_connect_err, INET_ERRNO);
SOCLOSE(port->port_channel);
return NULL;
}
@ -1523,7 +1502,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast)
SOCKET n = socket(AF_INET, SOCK_STREAM, 0);
if (n == INVALID_SOCKET) {
inet_error(port, "socket", isc_net_event_connect_err, ERRNO);
inet_error(port, "socket", isc_net_event_connect_err, INET_ERRNO);
return NULL;
}
@ -1537,7 +1516,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast)
THREAD_ENTER;
if (status < 0) {
inet_error(port, "connect", isc_net_event_connect_err, ERRNO);
inet_error(port, "connect", isc_net_event_connect_err, INET_ERRNO);
SOCLOSE(n);
return NULL;
}
@ -1553,7 +1532,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast)
#endif
if (ioctl(n, SIOCSPGRP, &arg) < 0) {
inet_error(port, "ioctl/SIOCSPGRP", isc_net_event_connect_err,
ERRNO);
INET_ERRNO);
SOCLOSE(port->port_channel);
return NULL;
}
@ -1595,7 +1574,7 @@ static rem_port* aux_request( rem_port* port, PACKET* packet)
SOCKET n = socket(AF_INET, SOCK_STREAM, 0);
if (n == INVALID_SOCKET) {
inet_error(port, "socket", isc_net_event_listen_err, ERRNO);
inet_error(port, "socket", isc_net_event_listen_err, INET_ERRNO);
return NULL;
}
@ -1604,19 +1583,19 @@ static rem_port* aux_request( rem_port* port, PACKET* packet)
(SCHAR *) &optval, sizeof(optval));
if (bind(n, (struct sockaddr *) &address, sizeof(address)) < 0) {
inet_error(port, "bind", isc_net_event_listen_err, ERRNO);
inet_error(port, "bind", isc_net_event_listen_err, INET_ERRNO);
return NULL;
}
socklen_t length = sizeof(address);
if (getsockname(n, (struct sockaddr *) &address, &length) < 0) {
inet_error(port, "getsockname", isc_net_event_listen_err, ERRNO);
inet_error(port, "getsockname", isc_net_event_listen_err, INET_ERRNO);
return NULL;
}
if (listen(n, 1) < 0) {
inet_error(port, "listen", isc_net_event_listen_err, ERRNO);
inet_error(port, "listen", isc_net_event_listen_err, INET_ERRNO);
return NULL;
}
@ -1633,7 +1612,7 @@ static rem_port* aux_request( rem_port* port, PACKET* packet)
struct sockaddr_in port_address;
if (getsockname((SOCKET) port->port_handle, (struct sockaddr *) &port_address, &length) < 0) {
inet_error(port, "getsockname", isc_net_event_listen_err, ERRNO);
inet_error(port, "getsockname", isc_net_event_listen_err, INET_ERRNO);
return NULL;
}
inet_copy(reinterpret_cast<SCHAR*>(&port_address.sin_addr),
@ -2483,7 +2462,7 @@ static rem_port* select_accept( rem_port* main_port)
port->port_handle = (HANDLE) accept((SOCKET) main_port->port_handle,
(struct sockaddr *) &address, &l);
if ((SOCKET) port->port_handle == INVALID_SOCKET) {
inet_error(port, "accept", isc_net_connect_err, ERRNO);
inet_error(port, "accept", isc_net_connect_err, INET_ERRNO);
disconnect(port);
return 0;
}
@ -2698,19 +2677,19 @@ static int select_wait( rem_port* main_port, SLCT * selct)
THREAD_ENTER;
return TRUE;
}
else if (INTERRUPT_ERROR(ERRNO))
else if (INTERRUPT_ERROR(INET_ERRNO))
continue;
#ifndef WIN_NT
else if (ERRNO == EBADF)
else if (INET_ERRNO == EBADF)
break;
#else
else if (ERRNO == WSAENOTSOCK)
else if (INET_ERRNO == WSAENOTSOCK)
break;
#endif
else {
THREAD_ENTER;
sprintf(msg, "INET/select_wait: select failed, errno = %d",
ERRNO);
INET_ERRNO);
gds__log(msg, 0);
return FALSE;
}
@ -3293,7 +3272,7 @@ static rem_port* inet_try_connect(
port->port_context = rdb;
if (!port->receive(packet)) {
inet_error(port, "receive in try_connect", isc_net_connect_err,
ERRNO);
INET_ERRNO);
disconnect(port);
ALLR_release((BLK) rdb);
return NULL;
@ -3527,7 +3506,7 @@ static int packet_receive(
// restore original timeout value FSG 3 MAY 2001
savetime = timeout;
if (slct_count != -1 || !INTERRUPT_ERROR(ERRNO))
if (slct_count != -1 || !INTERRUPT_ERROR(INET_ERRNO))
{
break;
}
@ -3537,7 +3516,7 @@ static int packet_receive(
if (slct_count == -1)
{
return inet_error(port, "select in packet_receive",
isc_net_read_err, ERRNO);
isc_net_read_err, INET_ERRNO);
}
if (!slct_count && port->port_protocol >= PROTOCOL_VERSION8)
@ -3570,7 +3549,7 @@ static int packet_receive(
recv((SOCKET) port->port_handle,
reinterpret_cast<char*>(buffer), buffer_length, 0);
THREAD_ENTER;
if (n != -1 || !INTERRUPT_ERROR(ERRNO))
if (n != -1 || !INTERRUPT_ERROR(INET_ERRNO))
break;
}
@ -3578,7 +3557,7 @@ static int packet_receive(
return FALSE;
if (n == -1)
return inet_error(port, "read", isc_net_read_err, ERRNO);
return inet_error(port, "read", isc_net_read_err, INET_ERRNO);
if (!n)
return inet_error(port, "read end_of_file", isc_net_read_err, 0);
@ -3653,11 +3632,11 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le
if (n == -1)
{
if (INTERRUPT_ERROR(ERRNO)) {
if (INTERRUPT_ERROR(INET_ERRNO)) {
continue;
}
return inet_error(port, "send", isc_net_write_err, ERRNO);
return inet_error(port, "send", isc_net_write_err, INET_ERRNO);
}
data += n;
@ -3675,7 +3654,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le
const char* b = buffer;
#endif
while ((n = send((SOCKET) port->port_handle, b, 1, MSG_OOB)) == -1 &&
(ERRNO == ENOBUFS || INTERRUPT_ERROR(ERRNO)))
(INET_ERRNO == ENOBUFS || INTERRUPT_ERROR(INET_ERRNO)))
{
if (count++ > 20) {
break;
@ -3724,7 +3703,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le
THREAD_ENTER;
if (n == -1) {
return inet_error(port, "send/oob", isc_net_write_err, ERRNO);
return inet_error(port, "send/oob", isc_net_write_err, INET_ERRNO);
}
}

View File

@ -32,7 +32,7 @@
*
*/
/*
$Id: inet_server.cpp,v 1.37 2004-05-02 23:06:05 skidder Exp $
$Id: inet_server.cpp,v 1.38 2004-05-05 21:54:55 brodsom Exp $
*/
#include "firebird.h"
#include <stdio.h>
@ -113,10 +113,6 @@ $Id: inet_server.cpp,v 1.37 2004-05-02 23:06:05 skidder Exp $
#define sigvector sigvec
#endif
#ifndef SV_INTERRUPT
#define SV_INTERRUPT 0
#endif
#ifdef SUPERSERVER
#ifndef WIN_NT
#define TEMP_DIR "/tmp"

View File

@ -47,12 +47,6 @@
#include <stdarg.h>
#define ERRNO GetLastError()
#ifndef SYS_ERR
#define SYS_ERR isc_arg_win32
#endif
#ifndef MAX_DATA
#define MAX_DATA 2048
#endif

View File

@ -46,18 +46,6 @@
#include <windows.h>
#endif /* WIN_NT */
#ifdef WIN_NT
#define ERRNO GetLastError()
#endif
#ifdef UNIX
#define ERRNO errno
#endif
#ifndef SYS_ERR
#define SYS_ERR isc_arg_win32
#endif
#define MAX_SEQUENCE 256
static int accept_connection(rem_port*, P_CNCT *);