]> 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 9b7bb20112d0c9854d792bd80a602d590900d115..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
  *
- * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.143 2004/01/09 21:08:50 momjian 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)
+#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++)
 
@@ -96,59 +113,47 @@ do { \
        CritSectionCount--; \
 } while(0)
 
-#define PG_USLEEP(_usec) \
-do { \
-#ifndef WIN32
-       /* This will overflow on systems with 32-bit ints for > ~2000 secs */ \
-       struct timeval delay; \
-       \
-       delay.tv_sec = (_usec) / 1000000; \
-       delay.tv_usec = ((_usec) % 1000000); \
-       (void) select(0, NULL, NULL, NULL, &delay); \
-#else
-       Sleep(_usec < 500) ? 1 : (_usec+500)/ 1000);
-#endif
-} while(0)
 
 /*****************************************************************************
  *       globals.h --                                                                                                                   *
  *****************************************************************************/
 
-/*
- * from postmaster/postmaster.c
- */
-extern bool ClientAuthInProgress;
-extern const bool ExecBackend;
-
-extern int     PostmasterMain(int argc, char *argv[]);
-#ifdef EXEC_BACKEND
-extern void SubPostmasterMain(int argc, char* argv[]);
-#endif
-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 char *DataDir;
+extern PGDLLIMPORT char *DataDir;
+
+extern PGDLLIMPORT int NBuffers;
+extern int     MaxBackends;
+extern int     MaxConnections;
 
-extern DLLIMPORT int MyProcPid;
-extern struct Port *MyProcPort;
+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
@@ -177,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
@@ -199,24 +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;
+
+extern int     VacuumCostPageHit;
+extern int     VacuumCostPageMiss;
+extern int     VacuumCostPageDirty;
+extern int     VacuumCostLimit;
+extern int     VacuumCostDelay;
+
+extern int     VacuumCostBalance;
+extern bool VacuumCostActive;
 
-/*
- *     A few postmaster startup options are exported here so the
- *     configuration file processor can access them.
- */
-extern bool NetServer;
-extern bool EnableSSL;
-extern bool SilentMode;
-extern int     MaxBackends;
-extern int     ReservedBackends;
-extern DLLIMPORT int NBuffers;
-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);
 
 
 /*****************************************************************************
@@ -226,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 */
 
 
 /*****************************************************************************
@@ -307,21 +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 IgnoreSystemIndexes(bool mode);
-extern bool IsIgnoringSystemIndexes(void);
+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(const char *datadir, bool amPostmaster);
+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);
+extern void process_shared_preload_libraries(void);
+extern void process_local_preload_libraries(void);
 
 #endif   /* MISCADMIN_H */