diff options
Diffstat (limited to 'src/backend/utils/init')
-rw-r--r-- | src/backend/utils/init/findbe.c | 58 | ||||
-rw-r--r-- | src/backend/utils/init/globals.c | 62 | ||||
-rw-r--r-- | src/backend/utils/init/miscinit.c | 28 | ||||
-rw-r--r-- | src/backend/utils/init/postinit.c | 59 |
4 files changed, 103 insertions, 104 deletions
diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c index 5e6aa7412a6..e2cc9219a74 100644 --- a/src/backend/utils/init/findbe.c +++ b/src/backend/utils/init/findbe.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.6 1997/09/07 04:53:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.7 1997/09/08 02:31:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,14 +43,14 @@ int ValidateBackend(char *path) { - struct stat buf; - uid_t euid; - struct group *gp; - struct passwd *pwp; - int i; - int is_r = 0; - int is_x = 0; - int in_grp = 0; + struct stat buf; + uid_t euid; + struct group *gp; + struct passwd *pwp; + int i; + int is_r = 0; + int is_x = 0; + int in_grp = 0; /* * Ensure that the file exists and is a regular file. @@ -153,12 +153,12 @@ ValidateBackend(char *path) int FindBackend(char *backend, char *argv0) { - char buf[MAXPGPATH + 2]; - char *p; - char *path, - *startp, - *endp; - int pathlen; + char buf[MAXPGPATH + 2]; + char *p; + char *path, + *startp, + *endp; + int pathlen; /* * for the postmaster: First try: use the backend that's located in @@ -222,20 +222,20 @@ FindBackend(char *backend, char *argv0) strcat(buf, "/postgres"); switch (ValidateBackend(buf)) { - case 0: /* found ok */ - strncpy(backend, buf, MAXPGPATH); - if (DebugLvl) - fprintf(stderr, "FindBackend: found \"%s\" using PATH\n", - backend); - free(path); - return (0); - case -1: /* wasn't even a candidate, keep looking */ - break; - case -2: /* found but disqualified */ - fprintf(stderr, "FindBackend: could not read backend \"%s\"\n", - buf); - free(path); - return (-1); + case 0: /* found ok */ + strncpy(backend, buf, MAXPGPATH); + if (DebugLvl) + fprintf(stderr, "FindBackend: found \"%s\" using PATH\n", + backend); + free(path); + return (0); + case -1: /* wasn't even a candidate, keep looking */ + break; + case -2: /* found but disqualified */ + fprintf(stderr, "FindBackend: could not read backend \"%s\"\n", + buf); + free(path); + return (-1); } if (!endp) /* last one */ break; diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index 2ed0c83e0b2..131e352ddfb 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.11 1997/09/07 04:53:48 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.12 1997/09/08 02:31:56 momjian Exp $ * * NOTES * Globals used all over the place should be declared here and not @@ -36,52 +36,52 @@ #include "catalog/catname.h" -int Portfd = -1; -int Noversion = 0; -int Quiet = 1; +int Portfd = -1; +int Noversion = 0; +int Quiet = 1; -int MasterPid; -char *DataDir; +int MasterPid; +char *DataDir; /* * The PGDATA directory user says to use, or defaults to via environment * variable. NULL if no option given and no environment variable set */ -Relation reldesc; /* current relation descriptor */ +Relation reldesc; /* current relation descriptor */ -char OutputFileName[MAXPGPATH] = ""; +char OutputFileName[MAXPGPATH] = ""; -BackendId MyBackendId; -BackendTag MyBackendTag; +BackendId MyBackendId; +BackendTag MyBackendTag; -char *UserName = NULL; -char *DatabaseName = NULL; -char *DatabasePath = NULL; +char *UserName = NULL; +char *DatabaseName = NULL; +char *DatabasePath = NULL; -bool MyDatabaseIdIsInitialized = false; -Oid MyDatabaseId = InvalidOid; -bool TransactionInitWasProcessed = false; +bool MyDatabaseIdIsInitialized = false; +Oid MyDatabaseId = InvalidOid; +bool TransactionInitWasProcessed = false; -bool IsUnderPostmaster = false; -bool IsPostmaster = false; +bool IsUnderPostmaster = false; +bool IsPostmaster = false; -short DebugLvl = 0; +short DebugLvl = 0; -int DateStyle = USE_POSTGRES_DATES; -bool EuroDates = false; -bool HasCTZSet = false; -bool CDayLight = false; -int CTimeZone = 0; -char CTZName[MAXTZLEN + 1] = ""; +int DateStyle = USE_POSTGRES_DATES; +bool EuroDates = false; +bool HasCTZSet = false; +bool CDayLight = false; +int CTimeZone = 0; +char CTZName[MAXTZLEN + 1] = ""; -char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better +char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better * malloc? XXX */ -char FloatFormat[20] = "%f"; +char FloatFormat[20] = "%f"; -int fsyncOff = 0; -int SortMem = 512; +int fsyncOff = 0; +int SortMem = 512; -char *IndexedCatalogNames[] = { +char *IndexedCatalogNames[] = { AttributeRelationName, ProcedureRelationName, TypeRelationName, @@ -105,7 +105,7 @@ char *IndexedCatalogNames[] = { * XXX this is a serious hack which should be fixed -cim 1/26/90 * ---------------- */ -char *SharedSystemRelationNames[] = { +char *SharedSystemRelationNames[] = { DatabaseRelationName, DefaultsRelationName, DemonRelationName, diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 71efb80d120..e608bb484f8 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.7 1997/09/07 04:53:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.8 1997/09/08 02:31:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -44,12 +44,12 @@ */ #define EnableAbortEnvVarName "POSTGRESABORT" -extern char *getenv(const char *name); /* XXX STDLIB */ +extern char *getenv(const char *name); /* XXX STDLIB */ /* from globals.c */ -extern char *DatabaseName; -extern char *UserName; -extern char *DatabasePath; +extern char *DatabaseName; +extern char *UserName; +extern char *DatabasePath; /* @@ -105,7 +105,7 @@ ExitPostgres(ExitStatus status) void AbortPostgres() { - char *abortValue = getenv(EnableAbortEnvVarName); + char *abortValue = getenv(EnableAbortEnvVarName); #ifdef __SABER__ saber_stop(); @@ -223,7 +223,7 @@ GetProcessingMode() * Returns path to database. * */ -char * +char * GetDatabasePath() { return DatabasePath; @@ -233,7 +233,7 @@ GetDatabasePath() * GetDatabaseName -- * Returns name of database. */ -char * +char * GetDatabaseName() { return DatabaseName; @@ -269,7 +269,7 @@ SetDatabaseName(char *name) * in pg_proc.h). Define GetPgUserName() as a macro - tgl 97/04/26 * ---------------- */ -char * +char * getpgusername() { return UserName; @@ -279,8 +279,8 @@ void SetPgUserName() { #ifndef NO_SECURITY - char *p; - struct passwd *pw; + char *p; + struct passwd *pw; if (IsUnderPostmaster) { @@ -306,7 +306,7 @@ SetPgUserName() * GetUserId and SetUserId * ---------------------------------------------------------------- */ -static Oid UserId = InvalidOid; +static Oid UserId = InvalidOid; Oid GetUserId() @@ -318,8 +318,8 @@ GetUserId() void SetUserId() { - HeapTuple userTup; - char *userName; + HeapTuple userTup; + char *userName; Assert(!OidIsValid(UserId));/* only once */ diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 5a8a1a83d4d..47e7842d451 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.13 1997/09/07 04:53:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.14 1997/09/08 02:31:58 momjian Exp $ * * NOTES * InitPostgres() is the function called from PostgresMain @@ -70,13 +70,13 @@ #include "port-protos.h" #include "libpq/libpq-be.h" -static void InitCommunication(void); -static void InitMyDatabaseId(void); -static void InitStdio(void); -static void InitUserid(void); +static void InitCommunication(void); +static void InitMyDatabaseId(void); +static void InitStdio(void); +static void InitUserid(void); -static IPCKey PostgresIpcKey; +static IPCKey PostgresIpcKey; /* ---------------------------------------------------------------- * InitPostgres support @@ -106,15 +106,15 @@ static IPCKey PostgresIpcKey; static void InitMyDatabaseId() { - int dbfd; - int fileflags; - int nbytes; - int max, - i; - HeapTuple tup; - Page pg; - PageHeader ph; - char *dbfname; + int dbfd; + int fileflags; + int nbytes; + int max, + i; + HeapTuple tup; + Page pg; + PageHeader ph; + char *dbfname; Form_pg_database tup_db; /* @@ -165,7 +165,7 @@ InitMyDatabaseId() /* look at each tuple on the page */ for (i = 0; i <= max; i++) { - int offset; + int offset; /* if it's a freed tuple, ignore it */ if (!(ph->pd_linp[i].lp_flags & LP_USED)) @@ -253,11 +253,11 @@ done: static void DoChdirAndInitDatabaseNameAndPath(char *name) { - char *reason; + char *reason; /* Failure reason returned by some function. NULL if no failure */ - int fd; - char errormsg[1000]; + int fd; + char errormsg[1000]; if ((fd = open(DataDir, O_RDONLY, 0)) == -1) sprintf(errormsg, "Database system does not exist. " @@ -266,8 +266,7 @@ DoChdirAndInitDatabaseNameAndPath(char *name) DataDir); else { - char myPath[MAXPGPATH]; /* DatabasePath points - * here! */ + char myPath[MAXPGPATH]; /* DatabasePath points here! */ close(fd); if (strlen(DataDir) + strlen(name) + 10 > sizeof(myPath)) @@ -317,8 +316,8 @@ DoChdirAndInitDatabaseNameAndPath(char *name) * The directories and PG_VERSION files are in * order. */ - int rc; /* return code from some - * function we call */ + int rc; /* return code from some function + * we call */ SetDatabasePath(myPath); SetDatabaseName(name); @@ -368,9 +367,9 @@ InitUserid() static void InitCommunication() { - char *postid; - char *postport; - IPCKey key = 0; + char *postid; + char *postport; + IPCKey key = 0; /* ---------------- * try and get the backend tag from POSTID @@ -495,8 +494,8 @@ InitStdio() * Be very careful with the order of calls in the InitPostgres function. * -------------------------------- */ -bool PostgresIsInitialized = false; -extern int NBuffers; +bool PostgresIsInitialized = false; +extern int NBuffers; /* * this global is used by wei for testing his code, but must be declared @@ -505,14 +504,14 @@ extern int NBuffers; */ /*int testFlag = 0;*/ -int lockingOff = 0; +int lockingOff = 0; /* */ void InitPostgres(char *name) /* database name */ { - bool bootstrap; /* true if BootstrapProcessing */ + bool bootstrap; /* true if BootstrapProcessing */ /* ---------------- * see if we're running in BootstrapProcessing mode |