]> granicus.if.org Git - postgresql/blobdiff - src/include/miscadmin.h
Change the declaration of struct varlena so that the length word is
[postgresql] / src / include / miscadmin.h
index 3093de0f888ab7b73323ab95c2c8e9aee16f36b6..d06b34be437401705a9b3a69008ecae6a50bc140 100644 (file)
@@ -1,28 +1,32 @@
 /*-------------------------------------------------------------------------
  *
  * miscadmin.h
- *       this file contains general postgres administration and initialization
+ *       This file contains general postgres administration and initialization
  *       stuff that used to be spread out between the following files:
  *             globals.h                                               global variables
  *             pdir.h                                                  directory path crud
  *             pinit.h                                                 postgres initialization
  *             pmod.h                                                  processing modes
+ *       Over time, this has also become the preferred place for widely known
+ *       resource-limitation stuff, such as work_mem and check_stack_depth().
  *
- *
- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: miscadmin.h,v 1.132 2003/08/04 04:03:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.201 2008/02/20 22:46:24 tgl Exp $
  *
  * NOTES
- *       some of the information in this file should be moved to
- *       other files.
+ *       some of the information in this file should be moved to other files.
  *
  *-------------------------------------------------------------------------
  */
 #ifndef MISCADMIN_H
 #define MISCADMIN_H
 
+#include "pgtime.h"                            /* for pg_time_t */
+
+
+#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
 
 
 /*****************************************************************************
 
 /* in globals.c */
 /* these are marked volatile because they are set by signal handlers: */
-extern DLLIMPORT volatile bool InterruptPending;
+extern PGDLLIMPORT volatile bool InterruptPending;
 extern volatile bool QueryCancelPending;
 extern volatile bool ProcDiePending;
 
 /* these are marked volatile because they are examined by signal handlers: */
 extern volatile bool ImmediateInterruptOK;
-extern volatile uint32 InterruptHoldoffCount;
-extern volatile uint32 CritSectionCount;
+extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount;
+extern PGDLLIMPORT volatile uint32 CritSectionCount;
 
-/* in postgres.c */
+/* in tcop/postgres.c */
 extern void ProcessInterrupts(void);
 
+#ifndef WIN32
+
 #define CHECK_FOR_INTERRUPTS() \
-       do { \
-               if (InterruptPending) \
-                       ProcessInterrupts(); \
-       } while(0)
+do { \
+       if (InterruptPending) \
+               ProcessInterrupts(); \
+} while(0)
+#else                                                  /* WIN32 */
+
+#define CHECK_FOR_INTERRUPTS() \
+do { \
+       if (UNBLOCKED_SIGNAL_QUEUE()) \
+               pgwin32_dispatch_queued_signals(); \
+       if (InterruptPending) \
+               ProcessInterrupts(); \
+} while(0)
+#endif   /* WIN32 */
+
 
 #define HOLD_INTERRUPTS()  (InterruptHoldoffCount++)
 
 #define RESUME_INTERRUPTS() \
-       do { \
-               Assert(InterruptHoldoffCount > 0); \
-               InterruptHoldoffCount--; \
-       } while(0)
+do { \
+       Assert(InterruptHoldoffCount > 0); \
+       InterruptHoldoffCount--; \
+} while(0)
 
 #define START_CRIT_SECTION()  (CritSectionCount++)
 
 #define END_CRIT_SECTION() \
-       do { \
-               Assert(CritSectionCount > 0); \
-               CritSectionCount--; \
-       } while(0)
+do { \
+       Assert(CritSectionCount > 0); \
+       CritSectionCount--; \
+} while(0)
 
 
 /*****************************************************************************
  *       globals.h --                                                                                                                   *
  *****************************************************************************/
 
-/*
- * from postmaster/postmaster.c
- */
-extern bool ClientAuthInProgress;
-extern const bool ExecBackend;
-
-extern int     PostmasterMain(int argc, char *argv[]);
-extern void ClosePostmasterPorts(bool pgstat_too);
-
 /*
  * from utils/init/globals.c
  */
+extern pid_t PostmasterPid;
 extern bool IsPostmasterEnvironment;
 extern bool IsUnderPostmaster;
 
 extern bool ExitOnAnyError;
 
-extern bool Noversion;
-extern char *DataDir;
+extern PGDLLIMPORT char *DataDir;
 
-extern DLLIMPORT int MyProcPid;
-extern struct Port *MyProcPort;
+extern PGDLLIMPORT int NBuffers;
+extern int     MaxBackends;
+extern int     MaxConnections;
+
+extern PGDLLIMPORT int MyProcPid;
+extern PGDLLIMPORT pg_time_t MyStartTime;
+extern PGDLLIMPORT struct Port *MyProcPort;
 extern long MyCancelKey;
 
 extern char OutputFileName[];
-extern char pg_pathname[];
+extern PGDLLIMPORT char my_exec_path[];
+extern char pkglib_path[];
+
+#ifdef EXEC_BACKEND
+extern char postgres_exec_path[];
+#endif
 
 /*
  * done in storage/backendid.h for now.
  *
  * extern BackendId    MyBackendId;
  */
-extern DLLIMPORT Oid MyDatabaseId;
+extern PGDLLIMPORT Oid MyDatabaseId;
+
+extern PGDLLIMPORT Oid MyDatabaseTableSpace;
 
 /*
  * Date/Time Configuration
@@ -162,6 +182,7 @@ extern DLLIMPORT Oid MyDatabaseId;
 #define USE_ISO_DATES                  1
 #define USE_SQL_DATES                  2
 #define USE_GERMAN_DATES               3
+#define USE_XSD_DATES                  4
 
 /* valid DateOrder values */
 #define DATEORDER_YMD                  0
@@ -184,29 +205,21 @@ extern int        CTimeZone;
 
 extern bool enableFsync;
 extern bool allowSystemTableMods;
-extern DLLIMPORT int SortMem;
-extern int     VacuumMem;
+extern PGDLLIMPORT int work_mem;
+extern PGDLLIMPORT int maintenance_work_mem;
 
-/*
- *     A few postmaster startup options are exported here so the
- *     configuration file processor can access them.
- */
+extern int     VacuumCostPageHit;
+extern int     VacuumCostPageMiss;
+extern int     VacuumCostPageDirty;
+extern int     VacuumCostLimit;
+extern int     VacuumCostDelay;
 
-extern bool NetServer;
-extern bool EnableSSL;
-extern bool SilentMode;
-extern int     MaxBackends;
+extern int     VacuumCostBalance;
+extern bool VacuumCostActive;
 
-#define DEF_MAXBACKENDS 32
-extern int     ReservedBackends;
-extern DLLIMPORT int NBuffers;
 
-#define DEF_NBUFFERS (DEF_MAXBACKENDS > 8 ? DEF_MAXBACKENDS * 2 : 16)
-extern int     PostPortNumber;
-extern int     Unix_socket_permissions;
-extern char *Unix_socket_group;
-extern char *UnixSocketDir;
-extern char *VirtualHost;
+/* in tcop/postgres.c */
+extern void check_stack_depth(void);
 
 
 /*****************************************************************************
@@ -216,31 +229,29 @@ extern char *VirtualHost;
 
 extern char *DatabasePath;
 
-/* in utils/misc/database.c */
-extern void GetRawDatabaseInfo(const char *name, Oid *db_id, char *path);
-extern char *ExpandDatabasePath(const char *path);
-
 /* now in utils/init/miscinit.c */
 extern void SetDatabasePath(const char *path);
 
-extern char *GetUserNameFromId(AclId userid);
-extern AclId GetUserId(void);
-extern void SetUserId(AclId userid);
-extern AclId GetSessionUserId(void);
-extern void SetSessionUserId(AclId userid);
-extern void InitializeSessionUserId(const char *username);
+extern char *GetUserNameFromId(Oid roleid);
+extern Oid     GetUserId(void);
+extern Oid     GetOuterUserId(void);
+extern Oid     GetSessionUserId(void);
+extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
+extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
+extern bool InSecurityDefinerContext(void);
+extern void InitializeSessionUserId(const char *rolename);
 extern void InitializeSessionUserIdStandalone(void);
-extern void SetSessionAuthorization(AclId userid, bool is_superuser);
+extern void SetSessionAuthorization(Oid userid, bool is_superuser);
+extern Oid     GetCurrentRoleId(void);
+extern void SetCurrentRoleId(Oid roleid, bool is_superuser);
 
 extern void SetDataDir(const char *dir);
-
-extern int FindExec(char *full_path, const char *argv0,
-                const char *binary_name);
-extern int     CheckPathAccess(char *path, char *name, int open_mode);
+extern void ChangeToDataDir(void);
+extern char *make_absolute_path(const char *path);
 
 /* in utils/misc/superuser.c */
 extern bool superuser(void);   /* current user is superuser */
-extern bool superuser_arg(AclId userid);               /* given user is superuser */
+extern bool superuser_arg(Oid roleid); /* given user is superuser */
 
 
 /*****************************************************************************
@@ -297,22 +308,26 @@ extern ProcessingMode Mode;
  *****************************************************************************/
 
 /* in utils/init/postinit.c */
-extern void InitPostgres(const char *dbname, const char *username);
+extern bool InitPostgres(const char *in_dbname, Oid dboid, const char *username,
+                        char **out_dbname);
 extern void BaseInit(void);
 
 /* in utils/init/miscinit.c */
-extern void CreateDataDirLockFile(const char *datadir, bool amPostmaster);
+extern bool IgnoreSystemIndexes;
+extern char *shared_preload_libraries_string;
+extern char *local_preload_libraries_string;
+
+extern void SetReindexProcessing(Oid heapOid, Oid indexOid);
+extern void ResetReindexProcessing(void);
+extern bool ReindexIsProcessingHeap(Oid heapOid);
+extern bool ReindexIsProcessingIndex(Oid indexOid);
+extern void CreateDataDirLockFile(bool amPostmaster);
 extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster);
 extern void TouchSocketLockFile(void);
 extern void RecordSharedMemoryInLockFile(unsigned long id1,
                                                         unsigned long id2);
-
 extern void ValidatePgVersion(const char *path);
-extern void process_preload_libraries(char *preload_libraries_string);
-
-/* these externs do not belong here... */
-extern void IgnoreSystemIndexes(bool mode);
-extern bool IsIgnoringSystemIndexes(void);
-extern bool IsCacheInitialized(void);
+extern void process_shared_preload_libraries(void);
+extern void process_local_preload_libraries(void);
 
 #endif   /* MISCADMIN_H */