本文整理汇总了C++中proc_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ proc_exit函数的具体用法?C++ proc_exit怎么用?C++ proc_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proc_exit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: finish_sync_worker
finish_sync_worker(void)
{
/*
* Commit any outstanding transaction. This is the usual case, unless
* there was nothing to do for the table.
*/
if (IsTransactionState())
{
CommitTransactionCommand();
pgstat_report_stat(false);
}
/* And flush all writes. */
XLogFlush(GetXLogWriteRecPtr());
StartTransactionCommand();
ereport(LOG,
(errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has finished",
MySubscription->name,
get_rel_name(MyLogicalRepWorker->relid))));
CommitTransactionCommand();
/* Find the main apply worker and signal it. */
logicalrep_worker_wakeup(MyLogicalRepWorker->subid, InvalidOid);
/* Stop gracefully */
proc_exit(0);
}
开发者ID:MasahikoSawada,项目名称:postgresql,代码行数:28,代码来源:tablesync.c
示例2: HandleStartupProcInterrupts
/* Handle SIGHUP and SIGTERM signals of startup process */
void
HandleStartupProcInterrupts(void)
{
/*
* Check if we were requested to re-read config file.
*/
if (got_SIGHUP)
{
got_SIGHUP = false;
ProcessConfigFile(PGC_SIGHUP);
}
/*
* Check if we were requested to exit without finishing recovery.
*/
if (shutdown_requested)
proc_exit(1);
/*
* Emergency bailout if postmaster has died. This is to avoid the
* necessity for manual cleanup of all postmaster children.
*/
if (IsUnderPostmaster && !PostmasterIsAlive())
exit(1);
}
开发者ID:Brar,项目名称:postgres,代码行数:26,代码来源:startup.c
示例3: sys_exit_group
long
sys_exit_group(va_list ap)
{
int status = va_arg(ap, int);
proc_exit(status);
while (1); /* We don't return after this */
return 0;
}
开发者ID:seL4,项目名称:refos,代码行数:8,代码来源:sys_exit.c
示例4: config_log_main
static void
config_log_main(Datum main_arg)
{
config_log_objects *objects;
pqsignal(SIGTERM, config_log_sigterm);
pqsignal(SIGHUP, config_log_sighup);
/* We're now ready to receive signals */
BackgroundWorkerUnblockSignals();
/* Connect to database */
BackgroundWorkerInitializeConnection(config_log_database, NULL);
/* Verify expected objects exist */
objects = initialize_objects();
while (!got_sigterm)
{
int rc;
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
100000L);
ResetLatch(&MyProc->procLatch);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
/*
* In case of a SIGHUP, just reload the configuration.
*/
if (got_sighup)
{
got_sighup = false;
ProcessConfigFile(PGC_SIGHUP);
execute_pg_settings_logger(objects);
}
}
proc_exit(0);
}
开发者ID:3manuek,项目名称:config_log,代码行数:43,代码来源:config_log.c
示例5: StartupProcessMain
/* ----------------------------------
* Startup Process main entry point
* ----------------------------------
*/
void
StartupProcessMain(void)
{
/*
* If possible, make this process a group leader, so that the postmaster
* can signal any child processes too.
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
elog(FATAL, "setsid() failed: %m");
#endif
/*
* Properly accept or ignore signals the postmaster might send us.
*/
pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */
pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */
pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */
pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */
InitializeTimeouts(); /* establishes SIGALRM handler */
pqsignal(SIGPIPE, SIG_IGN);
pqsignal(SIGUSR1, StartupProcSigUsr1Handler);
pqsignal(SIGUSR2, StartupProcTriggerHandler);
/*
* Reset some signals that are accepted by postmaster but not here
*/
pqsignal(SIGCHLD, SIG_DFL);
pqsignal(SIGTTIN, SIG_DFL);
pqsignal(SIGTTOU, SIG_DFL);
pqsignal(SIGCONT, SIG_DFL);
pqsignal(SIGWINCH, SIG_DFL);
/*
* Register timeouts needed for standby mode
*/
RegisterTimeout(STANDBY_DEADLOCK_TIMEOUT, StandbyDeadLockHandler);
RegisterTimeout(STANDBY_TIMEOUT, StandbyTimeoutHandler);
/*
* Unblock signals (they were blocked when the postmaster forked us)
*/
PG_SETMASK(&UnBlockSig);
/*
* Do what we came for.
*/
StartupXLOG();
/*
* Exit normally. Exit code 0 tells postmaster that we completed recovery
* successfully.
*/
proc_exit(0);
}
开发者ID:fdr,项目名称:postgres,代码行数:59,代码来源:startup.c
示例6: proc_entry
/**
* Entry point for all the processes.
*/
void proc_entry(void)
{
/*
* Return from a context switch assumes interrupts are disabled, so
* we need to explicitly re-enable them as soon as possible.
*/
IRQ_ENABLE;
/* Call the actual process's entry point */
proc_run();
proc_exit();
}
开发者ID:amdoolittle,项目名称:APRS_Projects,代码行数:14,代码来源:proc.c
示例7: auth_failed
/*
* Tell the user the authentication failed, but not (much about) why.
*
* There is a tradeoff here between security concerns and making life
* unnecessarily difficult for legitimate users. We would not, for example,
* want to report the password we were expecting to receive...
* But it seems useful to report the username and authorization method
* in use, and these are items that must be presumed known to an attacker
* anyway.
* Note that many sorts of failure report additional information in the
* postmaster log, which we hope is only readable by good guys.
*/
static void
auth_failed(Port *port, int status)
{
const char *authmethod = "Unknown auth method:";
/*
* If we failed due to EOF from client, just quit; there's no point in
* trying to send a message to the client, and not much point in
* logging the failure in the postmaster log. (Logging the failure
* might be desirable, were it not for the fact that libpq closes the
* connection unceremoniously if challenged for a password when it
* hasn't got one to send. We'll get a useless log entry for every
* psql connection under password auth, even if it's perfectly
* successful, if we log STATUS_EOF events.)
*/
if (status == STATUS_EOF)
proc_exit(0);
switch (port->auth_method)
{
case uaReject:
authmethod = "Rejected host:";
break;
case uaKrb4:
authmethod = "Kerberos4";
break;
case uaKrb5:
authmethod = "Kerberos5";
break;
case uaTrust:
authmethod = "Trusted";
break;
case uaIdent:
authmethod = "IDENT";
break;
case uaMD5:
case uaCrypt:
case uaPassword:
authmethod = "Password";
break;
#ifdef USE_PAM
case uaPAM:
authmethod = "PAM";
break;
#endif /* USE_PAM */
}
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("%s authentication failed for user \"%s\"",
authmethod, port->user_name)));
/* doesn't return */
}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:65,代码来源:auth.c
示例8: ProcessStandbyMessage
/*
* Process a status update message received from standby.
*/
static void
ProcessStandbyMessage(void)
{
char msgtype;
resetStringInfo(&reply_message);
/*
* Read the message contents.
*/
if (pq_getmessage(&reply_message, 0))
{
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected EOF on standby connection")));
proc_exit(0);
}
/*
* Check message type from the first byte.
*/
msgtype = pq_getmsgbyte(&reply_message);
switch (msgtype)
{
case 'r':
ProcessStandbyReplyMessage();
break;
case 'h':
ProcessStandbyHSFeedbackMessage();
break;
default:
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected message type \"%c\"", msgtype)));
proc_exit(0);
}
}
开发者ID:ibejoeb,项目名称:postgres,代码行数:43,代码来源:walsender.c
示例9: StartupProcShutdownHandler
/* SIGTERM: set flag to abort redo and exit */
static void
StartupProcShutdownHandler(SIGNAL_ARGS)
{
int save_errno = errno;
if (in_restore_command)
proc_exit(1);
else
shutdown_requested = true;
WakeupRecovery();
errno = save_errno;
}
开发者ID:Brar,项目名称:postgres,代码行数:14,代码来源:startup.c
示例10: PreRestoreCommand
void
PreRestoreCommand(void)
{
/*
* Set in_restore_command to tell the signal handler that we should exit
* right away on SIGTERM. We know that we're at a safe point to do that.
* Check if we had already received the signal, so that we don't miss a
* shutdown request received just before this.
*/
in_restore_command = true;
if (shutdown_requested)
proc_exit(1);
}
开发者ID:Brar,项目名称:postgres,代码行数:13,代码来源:startup.c
示例11: hello_main
void
hello_main(Datum main_arg)
{
/* Register functions for SIGTERM/SIGHUP management */
pqsignal(SIGHUP, hello_sighup);
pqsignal(SIGTERM, hello_sigterm);
/* We're now ready to receive signals */
BackgroundWorkerUnblockSignals();
while (true)
{
/* Wait 1s */
WaitLatch(MyLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
1000L,
PG_WAIT_EXTENSION);
ResetLatch(MyLatch);
/* Process signals */
if (got_sighup)
{
/* Process config file */
ProcessConfigFile(PGC_SIGHUP);
got_sighup = false;
ereport(LOG, (errmsg("hello signal: processed SIGHUP")));
}
if (got_sigterm)
{
/* Simply exit */
ereport(LOG, (errmsg("hello signal: processed SIGTERM")));
proc_exit(0);
}
}
/* No problems, so clean exit */
proc_exit(0);
}
开发者ID:michaelpq,项目名称:pg_plugins,代码行数:39,代码来源:hello_signal.c
示例12: BufferSaverMain
static void
BufferSaverMain(Datum main_arg)
{
WorkerCommon();
/*
* Main loop: do this until the SIGTERM handler tells us to terminate
*/
while (!got_sigterm)
{
int rc;
ResetLatch(&MyProc->procLatch);
/*
* Wait on the process latch, which sleeps as necessary, but is awakened
* if postmaster dies. This way the background process goes away
* immediately in case of an emergency.
*/
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
10 * 1000L);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
/*
* In case of a SIGHUP, just reload the configuration.
*/
if (got_sighup)
{
got_sighup = false;
ProcessConfigFile(PGC_SIGHUP);
}
}
/*
* We recieved the SIGTERM; Shutdown is in progress, so save the
* shared-buffer contents.
*/
/* Save the buffers only if the extension is enabled. */
if (guc_enabled)
SaveBuffers();
/*
* The worker exits here. A proc_exit(0) is not necessary, we'll let the
* caller do that.
*/
}
开发者ID:gurjeet,项目名称:pg_hibernator,代码行数:51,代码来源:pg_hibernate_9.3.c
示例13: worker_main
void worker_main(Datum arg)
{
int ret;
StringInfoData buf;
uint32 segment = UInt32GetDatum(arg);
/* Setup signal handlers */
pqsignal(SIGHUP, worker_sighup);
pqsignal(SIGTERM, worker_sigterm);
/* Allow signals */
BackgroundWorkerUnblockSignals();
initialize_worker(segment);
/* Connect to the database */
BackgroundWorkerInitializeConnection(job->datname, job->rolname);
elog(LOG, "%s initialized running job id %d", MyBgworkerEntry->bgw_name, job->job_id);
pgstat_report_appname(MyBgworkerEntry->bgw_name);
/* Initialize the query text */
initStringInfo(&buf);
appendStringInfo(&buf,
"SELECT * FROM %s.%s(%d, NULL)",
job_run_function.schema,
job_run_function.name,
job->job_id);
/* Initialize the SPI subsystem */
SetCurrentStatementStartTimestamp();
StartTransactionCommand();
SPI_connect();
PushActiveSnapshot(GetTransactionSnapshot());
pgstat_report_activity(STATE_RUNNING, buf.data);
SetCurrentStatementStartTimestamp();
/* And run the query */
ret = SPI_execute(buf.data, true, 0);
if (ret < 0)
elog(FATAL, "errors while executing %s", buf.data);
/* Commmit the transaction */
SPI_finish();
PopActiveSnapshot();
CommitTransactionCommand();
pgstat_report_activity(STATE_IDLE, NULL);
proc_exit(0);
}
开发者ID:proekt111,项目名称:elephant-worker,代码行数:51,代码来源:worker.c
示例14: CheckClosedConnection
/*
* Check if the remote end has closed the connection.
*/
static void
CheckClosedConnection(void)
{
unsigned char firstchar;
int r;
r = pq_getbyte_if_available(&firstchar);
if (r < 0)
{
/* unexpected error or EOF */
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected EOF on standby connection")));
proc_exit(0);
}
if (r == 0)
{
/* no data available without blocking */
return;
}
/* Handle the very limited subset of commands expected in this phase */
switch (firstchar)
{
/*
* 'X' means that the standby is closing down the socket.
*/
case 'X':
proc_exit(0);
default:
ereport(FATAL,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("invalid standby closing message type %d",
firstchar)));
}
}
开发者ID:adunstan,项目名称:pg-cvs-mirror,代码行数:40,代码来源:walsender.c
示例15: WalSendServer_ServicePostmasterDied
static void
WalSendServer_ServicePostmasterDied(void)
{
if (!isQDMirroringNotConfigured() &&
!isQDMirroringNotKnownYet() &&
!isQDMirroringDisabled())
{
/*
* Only complain if we were trying to do work.
*/
ereport(LOG,
(errmsg("exiting because postmaster has died")));
proc_exit(1);
}
}
开发者ID:leckie711,项目名称:incubator-hawq,代码行数:15,代码来源:walsendserver.c
示例16: exit
/*
* Release resources.
* Enter zombie state.
* Wake up parent and init processes,
* and dispose of children.
*/
void
exit(int why, int what)
{
/*
* If proc_exit() fails, then some other lwp in the process
* got there first. We just have to call lwp_exit() to allow
* the other lwp to finish exiting the process. Otherwise we're
* restarting init, and should return.
*/
if (proc_exit(why, what) != 0) {
mutex_enter(&curproc->p_lock);
ASSERT(curproc->p_flag & SEXITLWPS);
lwp_exit();
/* NOTREACHED */
}
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:22,代码来源:exit.c
示例17: SegmentInfoSenderLoop
/**
* Main loop of the sender process. It wakes up every
* gp_perfmon_segment_interval ms to send segment
* information to perfmon
*/
static void
SegmentInfoSenderLoop(void)
{
int rc;
int counter;
for (counter = 0;; counter += SEGMENT_INFO_LOOP_SLEEP_MS)
{
CHECK_FOR_INTERRUPTS();
if (senderShutdownRequested)
{
break;
}
/* no need to live on if postmaster has died */
if (!PostmasterIsAlive())
exit(1);
if (cluster_state_collect_hook)
cluster_state_collect_hook();
if (gp_enable_gpperfmon && counter >= gp_perfmon_segment_interval)
{
SegmentInfoSender();
counter = 0;
}
/* Sleep a while. */
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
SEGMENT_INFO_LOOP_SLEEP_MS);
ResetLatch(&MyProc->procLatch);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
} /* end server loop */
return;
}
开发者ID:adam8157,项目名称:gpdb,代码行数:46,代码来源:perfmon_segmentinfo.c
示例18: api_exit
/*
* ======== api_exit ========
*/
void api_exit(void)
{
DBC_REQUIRE(api_c_refs > 0);
api_c_refs--;
if (api_c_refs == 0) {
/* Release all modules initialized in api_init(). */
cod_exit();
dev_exit();
chnl_exit();
msg_exit();
io_exit();
strm_exit();
disp_exit();
node_exit();
proc_exit();
mgr_exit();
rmm_exit();
drv_exit();
}
DBC_ENSURE(api_c_refs >= 0);
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:25,代码来源:dspapi.c
示例19: capi_exit
static void __exit capi_exit(void)
{
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
unsigned int j;
#endif
alloc_exit();
(void)proc_exit();
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0));
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
for (j = 0; j < CAPINC_NR_PORTS; j++) {
char devname[32];
sprintf(devname, "capi/r%u", j);
devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
}
#endif
(void) detach_capi_interface(&cuser);
printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:23,代码来源:capi.c
示例20: thread_terminate_self
/*
* thread_terminate_self:
*/
void
thread_terminate_self(void)
{
thread_t thread = current_thread();
task_t task;
spl_t s;
int threadcnt;
DTRACE_PROC(lwp__exit);
thread_mtx_lock(thread);
ulock_release_all(thread);
ipc_thread_disable(thread);
thread_mtx_unlock(thread);
s = splsched();
thread_lock(thread);
/*
* Cancel priority depression, wait for concurrent expirations
* on other processors.
*/
if (thread->sched_flags & TH_SFLAG_DEPRESSED_MASK) {
thread->sched_flags &= ~TH_SFLAG_DEPRESSED_MASK;
if (timer_call_cancel(&thread->depress_timer))
thread->depress_timer_active--;
}
while (thread->depress_timer_active > 0) {
thread_unlock(thread);
splx(s);
delay(1);
s = splsched();
thread_lock(thread);
}
thread_sched_call(thread, NULL);
thread_unlock(thread);
splx(s);
thread_policy_reset(thread);
#if CONFIG_EMBEDDED
thead_remove_taskwatch(thread);
#endif /* CONFIG_EMBEDDED */
task = thread->task;
uthread_cleanup(task, thread->uthread, task->bsd_info);
threadcnt = hw_atomic_sub(&task->active_thread_count, 1);
/*
* If we are the last thread to terminate and the task is
* associated with a BSD process, perform BSD process exit.
*/
if (threadcnt == 0 && task->bsd_info != NULL)
proc_exit(task->bsd_info);
uthread_cred_free(thread->uthread);
s = splsched();
thread_lock(thread);
/*
* Cancel wait timer, and wait for
* concurrent expirations.
*/
if (thread->wait_timer_is_set) {
thread->wait_timer_is_set = FALSE;
if (timer_call_cancel(&thread->wait_timer))
thread->wait_timer_active--;
}
while (thread->wait_timer_active > 0) {
thread_unlock(thread);
splx(s);
delay(1);
s = splsched();
thread_lock(thread);
}
/*
* If there is a reserved stack, release it.
*/
if (thread->reserved_stack != 0) {
stack_free_reserved(thread);
thread->reserved_stack = 0;
//.........这里部分代码省略.........
开发者ID:CptFrazz,项目名称:xnu,代码行数:101,代码来源:thread.c
注:本文中的proc_exit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论