diff --git a/builds/posix/Makefile.in.firebird b/builds/posix/Makefile.in.firebird index a87cfc28cf..bf2717ff19 100644 --- a/builds/posix/Makefile.in.firebird +++ b/builds/posix/Makefile.in.firebird @@ -27,7 +27,7 @@ # Contributor(s): # # -# $Id: Makefile.in.firebird,v 1.18 2002-11-16 03:14:26 skywalker Exp $ +# $Id: Makefile.in.firebird,v 1.19 2002-11-18 13:22:45 eku Exp $ # ROOT=.. @@ -490,11 +490,14 @@ rebuild_codes : #___________________________________________________________________________ # Install generic files. -CLASSIC_MiscFiles = firebird.xinetd firebird.conf -SUPER_MiscFiles = firebird.init.d.generic firebird.init.d.mandrake README firebird.conf +CLASSIC_MiscFiles = firebird.conf +SUPER_MiscFiles = firebird.conf +ifeq ($(ArchType),super) +INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(SUPER_MiscFiles)) +else INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(CLASSIC_MiscFiles)) -#INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(SUPER_MiscFiles)) +endif misc_files : $(INSTALL_MiscFiles) @@ -512,8 +515,11 @@ CLASSIC_ScriptFiles = CSchangeRunUser.sh CSrestoreRootRunUser.sh changeDBAPasswo SUPER_ScriptFiles = SSchangeRunUser.sh SSrestoreRootRunUser.sh changeDBAPassword.sh +ifeq ($(ArchType),super) +INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(SUPER_ScriptFiles)) +else INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(CLASSIC_ScriptFiles)) -#INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(SUPER_ScriptFiles)) +endif script_files : $(INSTALL_ScriptFiles) diff --git a/configure.in b/configure.in index d35c793b30..065a976d3e 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.91 2002-11-18 02:57:39 skywalker Exp $ +dnl $Id: configure.in,v 1.92 2002-11-18 13:22:33 eku Exp $ dnl ############################# INITIALISATION ############################### @@ -29,7 +29,7 @@ AC_SUBST(CPU_TYPE) dnl EKU: set appropiate defaults for each platform dnl LOCK_MANAGER_FLG : build lock manager (CS only) -dnl EDITLINE_FLG : support fancy command line editing in isql +dnl EDITLINE_FLG : support fancy command line editing in isql case "$target" in *-*-darwin*) @@ -193,7 +193,6 @@ AC_ARG_WITH(editline, esac]) AC_SUBST(EDITLINE_FLG) - FB_SERVICE_NAME=gds_db FB_SERVICE_PORT=3050 AC_ARG_WITH(service-name, @@ -242,7 +241,7 @@ AC_CHECK_HEADERS(crypt.h) AC_CHECK_HEADERS(netinet/in.h rpc/rpc.h netconfig.h) AC_CHECK_HEADERS(rpc/xdr.h,,,[#include ]) AC_CHECK_HEADERS(aio.h) -AC_CHECK_HEADERS(mntent.h) +AC_CHECK_HEADERS(mntent.h mnttab.h sys/mntent.h sys/mnttab.h) dnl Check for libraries AC_CHECK_LIB(dl, main) @@ -259,6 +258,10 @@ if test "$EDITLINE_FLG" = "Y"; then fi AC_CHECK_LIB(stdc++, main,,, $LIBS) AC_CHECK_LIB(sfio, main,,, $LIBS) dnl Solaris only +dnl kkuznetsov: Solaris always check for -lnsl +if test "$PLATFORM" = "solx86" ; then + AC_CHECK_LIB(nsl, gethostname, XE_APPEND(-lnsl,LIBS)) +fi dnl Check for functions @@ -284,11 +287,6 @@ AC_CHECK_FUNCS(gethostname connect) if test "$ac_cv_func_gethostname" = "no"; then AC_CHECK_LIB(nsl, gethostname, XE_APPEND(-lnsl,LIBS)) fi - -if test "$PLATFORM" = "solx86" ; then - AC_CHECK_LIB(nsl, gethostname, XE_APPEND(-lnsl,LIBS)) -fi - if test "$ac_cv_func_connect" = "no"; then AC_CHECK_LIB(socket, connect, XE_APPEND(-lsocket,LIBS),, $LIBS) fi @@ -321,6 +319,16 @@ AC_CHECK_FUNCS(getpagesize) AC_CHECK_FUNCS(crypt) AC_CHECK_FUNCS(xdr_hyper) AC_CHECK_FUNCS(pread pwrite) +AC_CHECK_FUNCS(getcwd getwd) +AC_CHECK_FUNCS(setmntent getmntent) +if test "$ac_cv_func_getmntent" = "yes"; then + AC_MSG_CHECKING(if getmntent needs second argument) + AC_TRY_COMPILE([#include +#include ], + [FILE *f; struct mntent *m; getmntent(f, m);], + [AC_DEFINE(GETMNTENT_TAKES_TWO_ARGUMENTS) AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) +fi dnl Check for other things @@ -337,6 +345,7 @@ AC_CHECK_TYPES([struct XDR::xdr_ops],,,[#include AC_CHECK_TYPES([struct xdr_ops],,,[#include #include ]) + dnl EKU: try to determine the alignment of long and double dnl replaces ALIGNMENT and DOUBLE_ALIGN in src/jrd/common.h AC_MSG_CHECKING(alignment of long) @@ -429,7 +438,7 @@ NEW_FIREBIRD_DIR=$GEN_ROOT/firebird AC_SUBST(BUILD_ROOT_DIR) AC_SUBST(NEW_FIREBIRD_DIR) -AC_DEFINE_UNQUOTED(ISC_PREFIX, $(if test "x$prefix" = "xNONE" ; then echo \"$ac_default_prefix\"; else echo \"$prefix\"; fi)) +AC_DEFINE_UNQUOTED(FB_PREFIX, $(if test "x$prefix" = "xNONE" ; then echo \"$ac_default_prefix\"; else echo \"$prefix\"; fi)) AC_CONFIG_COMMANDS_PRE([ mkdir -p gen/csv @@ -610,8 +619,6 @@ case $PLATFORM in ]) ;; - - SINIX-Z) AC_CONFIG_FILES([ gen/install/pkginfo:src/install/arch-specific/sinixz/pkginfo.in diff --git a/src/include/gen/autoconfig_msvc.h b/src/include/gen/autoconfig_msvc.h index e3a876bcba..329bbc4ef3 100644 --- a/src/include/gen/autoconfig_msvc.h +++ b/src/include/gen/autoconfig_msvc.h @@ -74,6 +74,9 @@ #undef HAVE_RPC_XDR_H #undef HAVE_AIO_H #undef HAVE_MNTENT_H +#undef HAVE_MNTTAB_H +#undef HAVE_SYS_MNTENT_H +#undef HAVE_SYS_MNTTAB_H /* Functions */ @@ -103,6 +106,11 @@ #undef HAVE_XDR_HYPER #undef HAVE_PREAD #undef HAVE_PWRITE +#undef HAVE_GETCWD +#undef HAVE_GETWD +#undef HAVE_SETMNTENT +#undef HAVE_GETMNTENT +#undef GETMNTENT_TAKES_TWO_ARGUMENTS /* Types */ #undef socklen_t diff --git a/src/jrd/isc_file.cpp b/src/jrd/isc_file.cpp index 788286aad1..aee8aacdba 100644 --- a/src/jrd/isc_file.cpp +++ b/src/jrd/isc_file.cpp @@ -58,6 +58,17 @@ #include "../jrd/isc_f_proto.h" #include "../jrd/jrd_proto.h" +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_PWD_H +#include +#endif + #include "../common/config/config.h" /* VMS Specific Stuff */ @@ -88,16 +99,51 @@ typedef struct itm { #endif /* of ifdef VMS */ -/* Unix/NFS specific stuff */ +#ifdef SUPERSERVER +#define GETWD(buf) JRD_getdir(buf, MAXPATHLEN) +#else +#ifdef HAVE_GETCWD +#define GETWD(buf) getcwd(buf, MAXPATHLEN) +#else +#define GETWD getwd +#endif +#endif /* SUPERSERVER */ -#ifdef HAVE_PWD_H -#include + +/* Unix/NFS specific stuff */ +#ifndef NO_NFS +#ifdef HAVE_MNTENT_H +#include /* get setmntent/endmntent */ +#endif +#ifdef HAVE_SYS_MNTTAB_H +#include /* get MNTTAB/_PATH_MNTTAB */ #endif +/* EKU: if you get a compiler warning/error about redefinition of MTAB, + please remove the define from the platform-specific section below + and not here! */ +#ifdef MNTTAB +#define MTAB MNTTAB +#else +#ifdef _PATH_MNTTAB +#define MTAB _PATH_MNTTAB +#else +#define MTAB "/etc/mtab" +#endif +#endif + +#ifdef HAVE_SETMNTENT +#define MTAB_OPEN(path,type) setmntent(path, "r") +#define MTAB_CLOSE(stream) endmntent(stream) +#else +#define MTAB_OPEN(path,type) ib_fopen(path, type) +#define MTAB_CLOSE(stream) ib_fclose(stream) +#endif +#endif /* NO_NFS */ + + #ifdef hpux -#define GETWD(buf) getcwd (buf, MAXPATHLEN) #define MTAB "/etc/mnttab" -#include /* RITTER - added HP11 to the pre-processor condition below */ #if !(defined HP10 || defined HP11) #include @@ -105,38 +151,22 @@ typedef struct itm { #endif #ifdef SOLARIS -#define SV_MNTENT -#include #define MTAB "/etc/mnttab" -#define MTAB_OPEN(path,type) ib_fopen (path, type) -#define MTAB_CLOSE(stream) ib_fclose (stream) #endif #ifdef FREEBSD #define MTAB "/etc/fstab" -#define MTAB_OPEN(path,type) ib_fopen (path, type) -#define MTAB_CLOSE(stream) ib_fclose (stream) #endif #ifdef DARWIN #define MTAB "/etc/fstab.hd" -#define MTAB_OPEN(path,type) ib_fopen (path, type) -#define MTAB_CLOSE(stream) ib_fclose (stream) #endif #ifdef SCO_UNIX +/* EKU: popen/pclose to access a file??? */ #define MTAB "/etc/mount" #define MTAB_OPEN(path,type) popen (path, type) #define MTAB_CLOSE(stream) pclose (stream) -#define GETWD(buf) getcwd (buf, MAXPATHLEN) -#endif - -#ifdef SINIXZ -#include -#define SV_MNTENT -#define MTAB "/etc/mnttab" -#define MTAB_OPEN(path,type) fopen (path, type) -#define MTAB_CLOSE(stream) fclose (stream) #endif #ifdef ultrix @@ -148,30 +178,6 @@ typedef struct itm { #include #endif -#if (defined SOLARIS || defined linux || defined FREEBSD || defined NETBSD || defined DARWIN || defined SINIXZ) -#define GETWD(buf) getcwd (buf, MAXPATHLEN) -#endif - -#ifdef SUPERSERVER -#undef GETWD -#define GETWD(buf) JRD_getdir (buf, MAXPATHLEN) -#endif - -#ifndef GETWD -#define GETWD getwd -#endif - -#ifdef HAVE_MNTENT_H -#ifndef NO_NFS -#include -#define MTAB_OPEN(path,type) setmntent (path, "r") -#define MTAB_CLOSE(stream) endmntent (stream) -#endif -#endif - -#ifndef MTAB -#define MTAB "/etc/mtab" -#endif typedef struct mnt { TEXT *mnt_node; @@ -180,25 +186,6 @@ typedef struct mnt { } MNT; -/* Unix specific stuff */ - -#ifdef UNIX -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include -#include -#include - -#ifdef DARWIN -#include -#else -extern struct passwd *getpwnam(), *getpwuid(); -#endif -#endif // UNIX - - /* Windows NT stuff */ #ifdef WIN_NT #include @@ -1500,9 +1487,9 @@ static BOOLEAN get_mounts( } #endif - -#if defined(SV_MNTENT) && !defined(SOLARIS) +#if defined(HAVE_GETMNTENT) && !defined(SOLARIS) #define GET_MOUNTS +#if defined(GETMNTENT_TAKES_TWO_ARGUMENTS) /* SYSV stylish */ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) { /************************************** @@ -1547,14 +1534,12 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) else return FALSE; } -#endif -#ifdef SOLARIS -#define GET_MOUNTS +#else /* !GETMNTENT_TAKES_TWO_ARGUMENTS */ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) { /************************************** * - * g e t _ m o u n t s ( S O L A R I S ) + * g e t _ m o u n t s ( M N T E N T ) * ************************************** * @@ -1562,40 +1547,24 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) * Get ALL mount points. * **************************************/ - - /* Since we had to substitute our alternative for the stdio supplied - with Solaris, we cannot use the getmntent() library call which - wants a Solaris stdio FILE* as an argument, so we parse the text- - type /etc/mnttab file ourselves. */ - - TEXT device[128], mount_point[128], type[128], rw[128], foo1[128], *p, *q; - SSHORT n; + TEXT *p, *q; + struct mntent *mptr; /* Start by finding a mount point. */ p = buffer; - for (;;) { - /* device, mountpoint, type, options, a number */ - - n = ib_fscanf(file, "%s %s %s %s %s", - device, mount_point, type, rw, foo1); - - /* This should either be 5 (we got a line with 5 args, or EOF (we - got nothing. If we're short of 5, assume EOF */ - if (n != 5) - break; - + while ((mptr = getmntent(file)) != (struct mntent *)0) { /* Include non-NFS (local) mounts - some may be longer than NFS mount points */ /**** - if (strcmp (type, "nfs")) + if (strcmp (mptr->mnt_type, MNTTYPE_NFS)) continue; ****/ mount->mnt_node = p; - q = device; + q = mptr->mnt_fsname; while (*q && *q != ':') *p++ = *q++; *p++ = 0; @@ -1605,16 +1574,14 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) q++; mount->mnt_path = p; while (*p++ = *q++); - mount->mnt_mount = p; - q = mount_point; - while (*p++ = *q++); + mount->mnt_mount = mptr->mnt_dir; return TRUE; } return FALSE; } -#endif - +#endif /* GETMNTENT_TAKES_TWO_ARGUMENTS */ +#endif /* HAVE_GETMNTENT && !SOLARIS */ #ifdef SCO_UNIX #define GET_MOUNTS @@ -1679,57 +1646,6 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) } #endif - -#ifdef HAVE_MNTENT_H -#define GET_MOUNTS -static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) -{ -/************************************** - * - * g e t _ m o u n t s ( M N T E N T ) - * - ************************************** - * - * Functional description - * Get ALL mount points. - * - **************************************/ - TEXT *p, *q; - struct mntent *mptr; - -/* Start by finding a mount point. */ - - p = buffer; - - while (mptr = getmntent(file)) { - /* Include non-NFS (local) mounts - some may be longer than - NFS mount points */ - -/**** - if (strcmp (mptr->mnt_type, MNTTYPE_NFS)) - continue; -****/ - - mount->mnt_node = p; - q = mptr->mnt_fsname; - while (*q && *q != ':') - *p++ = *q++; - *p++ = 0; - if (*q != ':') - mount->mnt_node = NULL; - if (*q) - q++; - mount->mnt_path = p; - while (*p++ = *q++); - mount->mnt_mount = mptr->mnt_dir; - return TRUE; - } - - return FALSE; -} -#endif /* HAVE_MNTENT_H */ - - #ifndef GET_MOUNTS static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) { @@ -1751,10 +1667,12 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) p = buffer; for (;;) { - n = - ib_fscanf(file, "%s %s %s %s %s %s", device, mount_point, type, - rw, foo1, foo1); + n = ib_fscanf(file, "%s %s %s %s %s %s", device, mount_point, type, rw, foo1, foo1); +#ifdef SOLARIS + if (n != 5) +#else if (n < 0) +#endif break; /* Include non-NFS (local) mounts - some may be longer than @@ -1786,7 +1704,6 @@ static BOOLEAN get_mounts(MNT * mount, TEXT * buffer, IB_FILE * file) } #endif - #ifdef hpux /* RITTER - added HP11 to the pre-processor condition below */ #if !(defined HP10 || defined HP11) @@ -1799,7 +1716,7 @@ static BOOLEAN get_server(TEXT * file_name, TEXT * node_name) ************************************** * * Functional description - * If we're running on a cnode, the file system beSLONGs + * If we're running on a cnode, the file system belongs * to the server node - load node_name with the server * name and return TRUE. * diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index ab7db0a4f7..96c3d6bf34 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -4188,8 +4188,12 @@ USHORT JRD_getdir(TEXT * buf, USHORT len) pwd = getpwnam(buf); if (pwd) strcpy(buf, pwd->pw_dir); - else /* No home dir for this users here. Default to server dir */ + else /* No home dir for this users here. Default to server dir */ +#ifdef HAVE_GETCWD getcwd(buf, len); +#else + getwd(buf); +#endif #endif } else @@ -5095,7 +5099,11 @@ static void get_options(UCHAR* dpb, else { /*No home dir for this users here. Default to server dir */ **scratch = 0; +#ifdef HAVE_GETCWD if (getcwd(*scratch, MIN(MAXPATHLEN, buf_size))) +#else + if (getwd(*scratch)) +#endif l = strlen(*scratch) + 1; else l = buf_size; diff --git a/src/make.new/config/config.h.in b/src/make.new/config/config.h.in index 78437fd3aa..a3e70ea694 100644 --- a/src/make.new/config/config.h.in +++ b/src/make.new/config/config.h.in @@ -1,4 +1,4 @@ -#ident "$Id: config.h.in,v 1.59 2002-11-15 10:55:34 kkuznetsov Exp $" +#ident "$Id: config.h.in,v 1.60 2002-11-18 13:22:57 eku Exp $" /* * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports: @@ -55,6 +55,9 @@ #undef HAVE_RPC_XDR_H #undef HAVE_AIO_H #undef HAVE_MNTENT_H +#undef HAVE_MNTTAB_H +#undef HAVE_SYS_MNTENT_H +#undef HAVE_SYS_MNTTAB_H /* Functions */ @@ -84,6 +87,11 @@ #undef HAVE_XDR_HYPER #undef HAVE_PREAD #undef HAVE_PWRITE +#undef HAVE_GETCWD +#undef HAVE_GETWD +#undef HAVE_SETMNTENT +#undef HAVE_GETMNTENT +#undef GETMNTENT_TAKES_TWO_ARGUMENTS /* Types */ diff --git a/src/remote/interface.cpp b/src/remote/interface.cpp index 0bf42b9450..415ebdb580 100644 --- a/src/remote/interface.cpp +++ b/src/remote/interface.cpp @@ -4753,7 +4753,11 @@ static void add_working_directory(UCHAR* dpb_or_spb, if (node_name && !strcmp(node_name, "localhost")) { +#ifdef HAVE_GETCWD getcwd(cwd, sizeof(cwd)); +#else + getwd(cwd); +#endif } else {