Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e747c587
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e747c587
编写于
6月 27, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix for hang after postmaster restart. Add new proc_exit and
shmem_exit to replace exitpg().
上级
8fa93b01
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
130 addition
and
123 deletion
+130
-123
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+7
-7
src/backend/commands/async.c
src/backend/commands/async.c
+2
-2
src/backend/libpq/pqcomm.c
src/backend/libpq/pqcomm.c
+2
-2
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+8
-12
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/ipc.c
+63
-39
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/ipci.c
+2
-3
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmem.c
+2
-2
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/ipc/sinvaladt.c
+3
-3
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lock.c
+4
-10
src/backend/storage/lmgr/multi.c
src/backend/storage/lmgr/multi.c
+1
-8
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+3
-3
src/backend/storage/smgr/smgr.c
src/backend/storage/smgr/smgr.c
+2
-2
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+11
-11
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+4
-4
src/backend/utils/error/exc.c
src/backend/utils/error/exc.c
+2
-2
src/backend/utils/init/miscinit.c
src/backend/utils/init/miscinit.c
+5
-5
src/backend/utils/init/postinit.c
src/backend/utils/init/postinit.c
+3
-3
src/include/storage/ipc.h
src/include/storage/ipc.h
+6
-5
未找到文件。
src/backend/bootstrap/bootstrap.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.4
3 1998/06/15 19:28:04
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.4
4 1998/06/27 04:53:29
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -262,7 +262,7 @@ usage(void)
fprintf
(
stderr
,
" O: set BootstrapProcessing mode
\n
"
);
fprintf
(
stderr
,
" P portno: specify port number
\n
"
);
exitpg
(
1
);
proc_exit
(
1
);
}
...
...
@@ -360,7 +360,7 @@ BootstrapMain(int argc, char *argv[])
"database system either by specifying the -D invocation "
"option or by setting the PGDATA environment variable.
\n\n
"
,
argv
[
0
]);
exitpg
(
1
);
proc_exit
(
1
);
}
if
(
dbName
==
NULL
)
...
...
@@ -370,7 +370,7 @@ BootstrapMain(int argc, char *argv[])
{
fputs
(
"bootstrap backend: failed, no db name specified
\n
"
,
stderr
);
fputs
(
" and no USER enviroment variable
\n
"
,
stderr
);
exitpg
(
1
);
proc_exit
(
1
);
}
}
...
...
@@ -381,7 +381,7 @@ BootstrapMain(int argc, char *argv[])
if
(
IsUnderPostmaster
&&
portFd
<
0
)
{
fputs
(
"backend: failed, no -P option with -postmaster opt.
\n
"
,
stderr
);
exitpg
(
1
);
proc_exit
(
1
);
}
/* ----------------
...
...
@@ -770,12 +770,12 @@ cleanup()
else
{
elog
(
FATAL
,
"Memory manager fault: cleanup called twice.
\n
"
,
stderr
);
exitpg
(
1
);
proc_exit
(
1
);
}
if
(
reldesc
!=
(
Relation
)
NULL
)
heap_close
(
reldesc
);
CommitTransactionCommand
();
exitpg
(
Warnings
);
proc_exit
(
Warnings
);
}
/* ----------------
...
...
src/backend/commands/async.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.3
3 1998/06/15 19:28:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.3
4 1998/06/27 04:53:29
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -477,7 +477,7 @@ Async_Listen(char *relname, int pid)
*/
relnamei
=
malloc
(
NAMEDATALEN
);
/* persists to process exit */
StrNCpy
(
relnamei
,
relname
,
NAMEDATALEN
);
on_
exitpg
(
Async_UnlistenOnExit
,
(
caddr_t
)
relnamei
);
on_
shmem_exit
(
Async_UnlistenOnExit
,
(
caddr_t
)
relnamei
);
}
/*
...
...
src/backend/libpq/pqcomm.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.4
6 1998/06/21 16:39:1
0 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.4
7 1998/06/27 04:53:3
0 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -650,7 +650,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
}
if
(
family
==
AF_UNIX
)
on_
exitpg
(
StreamDoUnlink
,
NULL
);
on_
proc_exit
(
StreamDoUnlink
,
NULL
);
listen
(
fd
,
SOMAXCONN
);
...
...
src/backend/postmaster/postmaster.c
浏览文件 @
e747c587
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.
89 1998/06/18 03:43:59
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.
90 1998/06/27 04:53:31
momjian Exp $
*
* NOTES
*
...
...
@@ -895,7 +895,7 @@ reset_shared(short port)
static
void
pmdie
(
SIGNAL_ARGS
)
{
exitpg
(
0
);
proc_exit
(
0
);
}
/*
...
...
@@ -986,9 +986,9 @@ CleanupProc(int pid,
{
bp
=
(
Backend
*
)
DLE_VAL
(
curr
);
/*
*
----------------- SIGUSR1 is the special signal that sez
exit
* without
exitpg
and let the user know what's going on.
/*
-----------------
*
SIGUSR1 is the special signal that says
exit
* without
proc_exit
and let the user know what's going on.
* ProcSemaphoreKill() cleans up the backends semaphore. If
* SendStop is set (-s on command line), then we send a SIGSTOP so
* that we can core dumps from all backends by hand.
...
...
@@ -1020,10 +1020,6 @@ CleanupProc(int pid,
}
/*
* Quasi_exit means run all of the on_exitpg routines
* but don't acutally call exit(). The on_exit list of routines to do
* is also truncated.
*
* Nothing up my sleeve here, ActiveBackends means that since the last
* time we recreated shared memory and sems another frontend has
* requested and received a connection and I have forked off another
...
...
@@ -1036,7 +1032,7 @@ CleanupProc(int pid,
if
(
DebugLvl
)
fprintf
(
stderr
,
"%s: CleanupProc: reinitializing shared memory and semaphores
\n
"
,
progname
);
quasi_exitpg
();
shmem_exit
();
reset_shared
(
PostPortName
);
}
}
...
...
@@ -1230,7 +1226,7 @@ DoBackend(Port *port)
* Let's clean up ourselves as the postmaster child
*/
clear_
exitpg
();
/* we don't want the postmaster's exitpg
() handlers */
clear_
proc_exit
();
/* we don't want the postmaster's proc_exit
() handlers */
/* ----------------
* register signal handlers.
...
...
@@ -1352,7 +1348,7 @@ ExitPostmaster(int status)
StreamClose
(
ServerSock_INET
);
if
(
ServerSock_UNIX
!=
INVALID_SOCK
)
StreamClose
(
ServerSock_UNIX
);
exitpg
(
status
);
proc_exit
(
status
);
}
static
void
...
...
src/backend/storage/ipc/ipc.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.2
6 1998/06/23 16:04:46
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.2
7 1998/06/27 04:53:34
momjian Exp $
*
* NOTES
*
...
...
@@ -60,9 +60,9 @@ static struct ONEXIT
{
void
(
*
function
)
();
caddr_t
arg
;
}
on
exit_list
[
MAX_ON_EXITS
];
}
on_proc_exit_list
[
MAX_ON_EXITS
],
on_shmem_
exit_list
[
MAX_ON_EXITS
];
static
int
onexit_index
;
static
int
on
_proc_exit_index
,
on_shmem_
exit_index
;
static
void
IpcConfigTip
(
void
);
typedef
struct
_PrivateMemStruct
...
...
@@ -98,7 +98,7 @@ PrivateMemoryAttach(IpcMemoryId memid)
/* ----------------------------------------------------------------
*
exitpg
*
proc_exit
*
* this function calls all the callbacks registered
* for it (to free resources) and then calls exit.
...
...
@@ -106,100 +106,124 @@ PrivateMemoryAttach(IpcMemoryId memid)
* -cim 2/6/90
* ----------------------------------------------------------------
*/
static
int
exitpg
_inprogress
=
0
;
static
int
proc_exit
_inprogress
=
0
;
void
exitpg
(
int
code
)
proc_exit
(
int
code
)
{
int
i
;
/* ----------------
* if
exitpg
_inprocess is true, then it means that we
* if
proc_exit
_inprocess is true, then it means that we
* are being invoked from within an on_exit() handler
* and so we return immediately to avoid recursion.
* ----------------
*/
if
(
exitpg
_inprogress
)
if
(
proc_exit
_inprogress
)
return
;
exitpg
_inprogress
=
1
;
proc_exit
_inprogress
=
1
;
/* do our shared memory exits first */
shmem_exit
(
code
);
/* ----------------
* call all the callbacks registered before calling exit().
* ----------------
*/
for
(
i
=
onexit_index
-
1
;
i
>=
0
;
--
i
)
(
*
on
exit_list
[
i
].
function
)
(
code
,
on
exit_list
[
i
].
arg
);
for
(
i
=
on
_proc_
exit_index
-
1
;
i
>=
0
;
--
i
)
(
*
on
_proc_exit_list
[
i
].
function
)
(
code
,
on_proc_
exit_list
[
i
].
arg
);
exit
(
code
);
}
/* ------------------
* Run all of the on_
exitpg
routines but don't exit in the end.
* Run all of the on_
shmem_exit
routines but don't exit in the end.
* This is used by the postmaster to re-initialize shared memory and
* semaphores after a backend dies horribly
* ------------------
*/
static
int
shmem_exit_inprogress
=
0
;
void
quasi_exitpg
(
)
shmem_exit
(
int
code
)
{
int
i
;
/* ----------------
* if
exitpg
_inprocess is true, then it means that we
* if
shmem_exit
_inprocess is true, then it means that we
* are being invoked from within an on_exit() handler
* and so we return immediately to avoid recursion.
* ----------------
*/
if
(
exitpg
_inprogress
)
if
(
shmem_exit
_inprogress
)
return
;
exitpg
_inprogress
=
1
;
shmem_exit
_inprogress
=
1
;
/* ----------------
* call all the callbacks registered before calling exit().
* ----------------
*/
for
(
i
=
onexit_index
-
1
;
i
>=
0
;
--
i
)
/* Don't do StreamDoUnlink on quasi_exit */
if
(
onexit_list
[
i
].
function
!=
StreamDoUnlink
)
(
*
onexit_list
[
i
].
function
)
(
0
,
onexit_list
[
i
].
arg
);
for
(
i
=
on_shmem_exit_index
-
1
;
i
>=
0
;
--
i
)
(
*
on_shmem_exit_list
[
i
].
function
)
(
code
,
on_shmem_exit_list
[
i
].
arg
);
on_shmem_exit_index
=
0
;
shmem_exit_inprogress
=
0
;
}
onexit_index
=
0
;
exitpg_inprogress
=
0
;
/* ----------------------------------------------------------------
* on_proc_exit
*
* this function adds a callback function to the list of
* functions invoked by proc_exit(). -cim 2/6/90
* ----------------------------------------------------------------
*/
int
on_proc_exit
(
void
(
*
function
)
(),
caddr_t
arg
)
{
if
(
on_proc_exit_index
>=
MAX_ON_EXITS
)
return
(
-
1
);
on_proc_exit_list
[
on_proc_exit_index
].
function
=
function
;
on_proc_exit_list
[
on_proc_exit_index
].
arg
=
arg
;
++
on_proc_exit_index
;
return
(
0
);
}
/* ----------------------------------------------------------------
* on_
exitpg
* on_
shmem_exit
*
* this function adds a callback function to the list of
* functions invoked by
exitpg
(). -cim 2/6/90
* functions invoked by
shmem_exit
(). -cim 2/6/90
* ----------------------------------------------------------------
*/
int
on_
exitpg
(
void
(
*
function
)
(),
caddr_t
arg
)
on_
shmem_exit
(
void
(
*
function
)
(),
caddr_t
arg
)
{
if
(
onexit_index
>=
MAX_ON_EXITS
)
if
(
on
_shmem_
exit_index
>=
MAX_ON_EXITS
)
return
(
-
1
);
on
exit_list
[
on
exit_index
].
function
=
function
;
on
exit_list
[
on
exit_index
].
arg
=
arg
;
on
_shmem_exit_list
[
on_shmem_
exit_index
].
function
=
function
;
on
_shmem_exit_list
[
on_shmem_
exit_index
].
arg
=
arg
;
++
onexit_index
;
++
on
_shmem_
exit_index
;
return
(
0
);
}
/* ----------------------------------------------------------------
* clear_
exitpg
* clear_
proc_exit
*
* this function clears all
exitpg
() registered functions.
* this function clears all
proc_exit
() registered functions.
* ----------------------------------------------------------------
*/
void
clear_
exitpg
(
void
)
clear_
proc_exit
(
void
)
{
onexit_index
=
0
;
on
_proc_
exit_index
=
0
;
}
/****************************************************************************/
...
...
@@ -301,7 +325,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
{
perror
(
"semget"
);
IpcConfigTip
();
exitpg
(
3
);
proc_exit
(
3
);
}
for
(
i
=
0
;
i
<
semNum
;
i
++
)
array
[
i
]
=
semStartValue
;
...
...
@@ -314,7 +338,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
}
if
(
removeOnExit
)
on_
exitpg
(
IPCPrivateSemaphoreKill
,
(
caddr_t
)
semId
);
on_
shmem_exit
(
IPCPrivateSemaphoreKill
,
(
caddr_t
)
semId
);
}
else
...
...
@@ -418,7 +442,7 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
{
perror
(
"semop"
);
IpcConfigTip
();
exitpg
(
255
);
proc_exit
(
255
);
}
}
...
...
@@ -463,7 +487,7 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
{
perror
(
"semop"
);
IpcConfigTip
();
exitpg
(
255
);
proc_exit
(
255
);
}
}
...
...
@@ -517,7 +541,7 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
}
/* if (memKey == PrivateIPCKey) */
on_
exitpg
(
IPCPrivateMemoryKill
,
(
caddr_t
)
shmid
);
on_
shmem_exit
(
IPCPrivateMemoryKill
,
(
caddr_t
)
shmid
);
return
(
shmid
);
}
...
...
@@ -583,7 +607,7 @@ IpcMemoryAttach(IpcMemoryId memId)
}
if
(
!
UsePrivateMemory
)
on_
exitpg
(
IpcMemoryDetach
,
(
caddr_t
)
memAddress
);
on_
shmem_exit
(
IpcMemoryDetach
,
(
caddr_t
)
memAddress
);
return
((
char
*
)
memAddress
);
}
...
...
src/backend/storage/ipc/ipci.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.1
3 1998/06/26 19:57:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.1
4 1998/06/27 04:53:35
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -92,7 +92,6 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
* ----------------
*/
InitLocks
();
InitMultiLevelLocks
();
if
(
InitMultiLevelLocks
()
==
INVALID_TABLEID
)
elog
(
FATAL
,
"Couldn't create the lock table"
);
...
...
@@ -101,7 +100,7 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
* ----------------
*/
InitProcGlobal
(
key
);
on_
exitpg
(
ProcFreeAllSemaphores
,
NULL
);
on_
shmem_exit
(
ProcFreeAllSemaphores
,
NULL
);
CreateSharedInvalidationState
(
key
);
}
...
...
src/backend/storage/ipc/shmem.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.2
2 1998/06/25 14:24:34
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.2
3 1998/06/27 04:53:36
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -524,7 +524,7 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr)
}
else
{
/* look it up in the bindin
t
table */
/* look it up in the bindin
g
table */
result
=
(
BindingEnt
*
)
hash_search
(
BindingTable
,
(
char
*
)
&
item
,
HASH_ENTER
,
foundPtr
);
}
...
...
src/backend/storage/ipc/sinvaladt.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.1
0 1998/06/18 04:20:34
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.1
1 1998/06/27 04:53:36
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -100,7 +100,7 @@ SIBackendInit(SISeg *segInOutP)
#endif
/* INVALIDDEBUG */
SISetActiveProcess
(
segInOutP
,
MyBackendId
);
on_
exitpg
(
CleanupInvalidationState
,
(
caddr_t
)
segInOutP
);
on_
shmem_exit
(
CleanupInvalidationState
,
(
caddr_t
)
segInOutP
);
return
1
;
}
...
...
@@ -193,7 +193,7 @@ SISetDeadProcess(SISeg *segP, int backendId)
* CleanupInvalidationState --
* Note:
* This is a temporary hack. ExitBackend should call this instead
* of exit (via on_
exitpg
).
* of exit (via on_
shmem_exit
).
*/
static
void
CleanupInvalidationState
(
int
status
,
/* XXX */
...
...
src/backend/storage/lmgr/lock.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.2
8 1998/06/26 01:58:45
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.2
9 1998/06/27 04:53:37
momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
...
...
@@ -153,7 +153,7 @@ static LOCKTAB *AllTables[MAX_TABLES];
* no zero-th table
* -------------------
*/
static
int
NumTables
=
1
;
static
int
NumTables
;
/* -------------------
* InitLocks -- Init the lock module. Create a private data
...
...
@@ -242,14 +242,6 @@ LockTableInit(char *tabName,
return
(
INVALID_TABLEID
);
}
if
(
NumTables
>
MAX_TABLES
)
{
elog
(
NOTICE
,
"LockTableInit: system limit of MAX_TABLES (%d) lock tables"
,
MAX_TABLES
);
return
(
INVALID_TABLEID
);
}
/* allocate a string for the binding table lookup */
shmemName
=
(
char
*
)
palloc
((
unsigned
)
(
strlen
(
tabName
)
+
32
));
if
(
!
shmemName
)
...
...
@@ -289,6 +281,8 @@ LockTableInit(char *tabName,
status
=
FALSE
;
}
NumTables
=
1
;
/* ----------------
* we're first - initialize
* ----------------
...
...
src/backend/storage/lmgr/multi.c
浏览文件 @
e747c587
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.1
6 1998/06/26 19:57:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.1
7 1998/06/27 04:53:38
momjian Exp $
*
* NOTES:
* (1) The lock.c module assumes that the caller here is doing
...
...
@@ -89,13 +89,6 @@ InitMultiLevelLocks()
{
int
tableId
;
/* -----------------------
* If we're already initialized just return the table id.
* -----------------------
*/
if
(
MultiTableId
)
return
MultiTableId
;
tableId
=
LockTableInit
(
"LockTable"
,
MultiConflicts
,
MultiPrios
,
5
);
MultiTableId
=
tableId
;
if
(
!
(
MultiTableId
))
...
...
src/backend/storage/lmgr/proc.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
6 1998/06/19 02:55:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
7 1998/06/27 04:53:39
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
6 1998/06/19 02:55:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
7 1998/06/27 04:53:39
momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
...
...
@@ -274,7 +274,7 @@ InitProcess(IPCKey key)
MyProc
->
errType
=
NO_ERROR
;
SHMQueueElemInit
(
&
(
MyProc
->
links
));
on_
exitpg
(
ProcKill
,
(
caddr_t
)
MyProcPid
);
on_
shmem_exit
(
ProcKill
,
(
caddr_t
)
MyProcPid
);
ProcInitialized
=
TRUE
;
}
...
...
src/backend/storage/smgr/smgr.c
浏览文件 @
e747c587
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.1
6 1998/06/23 15:35:45
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.1
7 1998/06/27 04:53:40
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -100,7 +100,7 @@ smgrinit()
}
/* register the shutdown proc */
on_
exitpg
(
smgrshutdown
,
NULL
);
on_
proc_exit
(
smgrshutdown
,
NULL
);
return
(
SM_SUCCESS
);
}
...
...
src/backend/tcop/postgres.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.7
7 1998/06/16 07:29:30
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.7
8 1998/06/27 04:53:43
momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -263,7 +263,7 @@ InteractiveBackend(char *inBuf)
if
(
!
Quiet
)
puts
(
"EOF"
);
IsEmptyQuery
=
true
;
exitpg
(
0
);
proc_exit
(
0
);
}
/* ----------------
...
...
@@ -312,7 +312,7 @@ SocketBackend(char *inBuf)
* when front-end applications quits/dies
* ------------
*/
exitpg
(
0
);
proc_exit
(
0
);
}
switch
(
*
qtype
)
...
...
@@ -1176,7 +1176,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if
(
errs
||
argc
-
optind
>
1
)
{
usage
(
argv
[
0
]);
exitpg
(
1
);
proc_exit
(
1
);
}
else
if
(
argc
-
optind
==
1
)
DBName
=
argv
[
optind
];
...
...
@@ -1184,14 +1184,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
{
fprintf
(
stderr
,
"%s: USER undefined and no database specified
\n
"
,
argv
[
0
]);
exitpg
(
1
);
proc_exit
(
1
);
}
if
(
ShowStats
&&
(
ShowParserStats
||
ShowPlannerStats
||
ShowExecutorStats
))
{
fprintf
(
stderr
,
"-s can not be used together with -t.
\n
"
);
exitpg
(
1
);
proc_exit
(
1
);
}
if
(
!
DataDir
)
...
...
@@ -1201,7 +1201,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
"database system either by specifying the -D invocation "
"option or by setting the PGDATA environment variable.
\n\n
"
,
argv
[
0
]);
exitpg
(
1
);
proc_exit
(
1
);
}
Noversion
=
flagC
;
...
...
@@ -1325,7 +1325,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if
(
!
IsUnderPostmaster
)
{
puts
(
"
\n
POSTGRES backend interactive interface"
);
puts
(
"$Revision: 1.7
7 $ $Date: 1998/06/16 07:29:30
$"
);
puts
(
"$Revision: 1.7
8 $ $Date: 1998/06/27 04:53:43
$"
);
}
/* ----------------
...
...
@@ -1335,7 +1335,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
* ----------------
*/
if
(
!
TransactionFlushEnabled
())
on_
exitpg
(
FlushBufferPool
,
NULL
);
on_
shmem_exit
(
FlushBufferPool
,
NULL
);
for
(;;)
{
...
...
@@ -1427,7 +1427,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
*/
case
'X'
:
pq_close
();
exitpg
(
0
);
proc_exit
(
0
);
break
;
default:
...
...
@@ -1458,7 +1458,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
}
}
/* infinite for-loop */
exitpg
(
0
);
proc_exit
(
0
);
return
1
;
}
...
...
src/backend/utils/error/elog.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.
29 1998/06/15 19:29:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.
30 1998/06/27 04:53:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -142,7 +142,7 @@ elog(int lev, const char *fmt,...)
write
(
open
(
"/dev/console"
,
O_WRONLY
,
0666
),
line
,
len
);
fflush
(
stdout
);
fflush
(
stderr
);
exitpg
(
lev
);
proc_exit
(
lev
);
}
fsync
(
Err_file
);
}
...
...
@@ -201,14 +201,14 @@ elog(int lev, const char *fmt,...)
fflush
(
stderr
);
ProcReleaseSpins
(
NULL
);
/* get rid of spinlocks we hold */
ProcReleaseLocks
();
/* get rid of real locks we hold */
exitpg
(
0
);
proc_exit
(
0
);
}
if
(
lev
>
FATAL
)
{
fflush
(
stdout
);
fflush
(
stderr
);
exitpg
(
lev
);
proc_exit
(
lev
);
}
}
...
...
src/backend/utils/error/exc.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.2
0 1998/02/26 04:37:3
5 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.2
1 1998/06/27 04:53:4
5 momjian Exp $
*
* NOTE
* XXX this code needs improvement--check for state violations and
...
...
@@ -78,7 +78,7 @@ EnableExceptionHandling(bool on)
if
(
on
==
ExceptionHandlingEnabled
)
{
/* XXX add logging of failed state */
exitpg
(
255
);
proc_exit
(
255
);
/* ExitPostgres(FatalExitStatus); */
}
...
...
src/backend/utils/init/miscinit.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.1
5 1998/05/29 17:00:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.1
6 1998/06/27 04:53:47
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -84,7 +84,7 @@ unsigned char RecodeBackTable[128];
void
ExitPostgres
(
ExitStatus
status
)
{
exitpg
(
status
);
proc_exit
(
status
);
}
/*
...
...
@@ -111,7 +111,7 @@ AbortPostgres()
if
(
PointerIsValid
(
abortValue
)
&&
abortValue
[
0
]
!=
'\0'
)
abort
();
else
exitpg
(
FatalExitStatus
);
proc_exit
(
FatalExitStatus
);
}
#endif
...
...
@@ -125,7 +125,7 @@ StatusBackendExit(int status)
{
/* someday, do some real cleanup and then call the LISP exit */
/* someday, call StatusPostmasterExit if running without postmaster */
exitpg
(
status
);
proc_exit
(
status
);
}
/* ----------------
...
...
@@ -136,7 +136,7 @@ void
StatusPostmasterExit
(
int
status
)
{
/* someday, do some real cleanup and then call the LISP exit */
exitpg
(
status
);
proc_exit
(
status
);
}
/* ----------------------------------------------------------------
...
...
src/backend/utils/init/postinit.c
浏览文件 @
e747c587
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.
29 1998/06/15 19:29:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.
30 1998/06/27 04:53:48
momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
...
...
@@ -481,7 +481,7 @@ InitPostgres(char *name) /* database name */
InitLocalBuffer
();
if
(
!
TransactionFlushEnabled
())
on_
exitpg
(
FlushBufferPool
,
(
caddr_t
)
NULL
);
on_
shmem_exit
(
FlushBufferPool
,
(
caddr_t
)
NULL
);
/* ----------------
* initialize the database id used for system caches and lock tables
...
...
@@ -601,7 +601,7 @@ InitPostgres(char *name) /* database name */
* ----------------
*/
PostgresIsInitialized
=
true
;
/* on_
exitpg
(DestroyLocalRelList, (caddr_t) NULL); */
/* on_
shmem_exit
(DestroyLocalRelList, (caddr_t) NULL); */
/* ----------------
* Done with "InitPostgres", now change to NormalProcessing unless
...
...
src/include/storage/ipc.h
浏览文件 @
e747c587
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: ipc.h,v 1.2
6 1998/06/23 15:35:48
momjian Exp $
* $Id: ipc.h,v 1.2
7 1998/06/27 04:53:49
momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
...
...
@@ -71,10 +71,11 @@ typedef int IpcMemoryId;
/* ipc.c */
extern
void
exitpg
(
int
code
);
extern
void
quasi_exitpg
(
void
);
extern
int
on_exitpg
(
void
(
*
function
)
(),
caddr_t
arg
);
extern
void
clear_exitpg
(
void
);
extern
void
proc_exit
(
int
code
);
extern
void
shmem_exit
(
int
code
);
extern
int
on_shmem_exit
(
void
(
*
function
)
(),
caddr_t
arg
);
extern
int
on_proc_exit
(
void
(
*
function
)
(),
caddr_t
arg
);
extern
void
clear_proc_exit
(
void
);
extern
IpcSemaphoreId
IpcSemaphoreCreate
(
IpcSemaphoreKey
semKey
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录