|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <fcntl.h>#include <limits.h>#include <signal.h>#include <unistd.h>#include <poll.h>#include "libpq/pqsignal.h"#include "miscadmin.h"#include "pgstat.h"#include "port/atomics.h"#include "portability/instr_time.h"#include "postmaster/postmaster.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/pmsignal.h"#include "storage/latch.h"#include "storage/waiteventset.h"#include "utils/memutils.h"#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
| struct | WaitEventSet |
Macros | |
| #define | WAIT_USE_POLL |
| #define | WAIT_USE_SELF_PIPE |
Variables | |
| static volatile sig_atomic_t | waiting = false |
| static int | selfpipe_readfd = -1 |
| static int | selfpipe_writefd = -1 |
| static int | selfpipe_owner_pid = 0 |
| static const ResourceOwnerDesc | wait_event_set_resowner_desc |
| #define WAIT_USE_POLL |
Definition at line 95 of file waiteventset.c.
| #define WAIT_USE_SELF_PIPE |
Definition at line 112 of file waiteventset.c.
| int AddWaitEventToSet | ( | WaitEventSet * | set, |
| uint32 | events, | ||
| pgsocket | fd, | ||
| Latch * | latch, | ||
| void * | user_data | ||
| ) |
Definition at line 570 of file waiteventset.c.
References Assert(), elog, ERROR, WaitEventSet::events, WaitEventSet::exit_on_postmaster_death, fd(), WaitEventSet::latch, WaitEventSet::latch_pos, MyProcPid, WaitEventSet::nevents, WaitEventSet::nevents_space, Latch::owner_pid, PGINVALID_SOCKET, WaitEvent::pos, postmaster_alive_fds, POSTMASTER_FD_WATCH, selfpipe_readfd, WaitEventAdjustPoll(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_POSTMASTER_DEATH, and WL_SOCKET_MASK.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), InitializeLatchWaitSet(), postgresForeignAsyncConfigureWait(), pq_init(), SysLoggerMain(), and WaitLatchOrSocket().
| WaitEventSet * CreateWaitEventSet | ( | ResourceOwner | resowner, |
| int | nevents | ||
| ) |
Definition at line 364 of file waiteventset.c.
References AcquireExternalFD(), close, data, elog, ERROR, WaitEventSet::events, WaitEventSet::exit_on_postmaster_death, WaitEventSet::latch, MAXALIGN, MemoryContextAllocZero(), WaitEventSet::nevents_space, WaitEventSet::owner, pgwin32_signal_event, WaitEventSet::pollfds, ReleaseExternalFD(), ResourceOwnerEnlarge(), ResourceOwnerRememberWaitEventSet(), StaticAssertStmt, and TopMemoryContext.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), InitializeLatchWaitSet(), pq_init(), SysLoggerMain(), and WaitLatchOrSocket().
|
static |
Definition at line 1945 of file waiteventset.c.
References buf, EAGAIN, EINTR, elog, ERROR, EWOULDBLOCK, fd(), read, selfpipe_readfd, and waiting.
Referenced by WaitEventSetWaitBlock().
| void FreeWaitEventSet | ( | WaitEventSet * | set | ) |
Definition at line 481 of file waiteventset.c.
References close, WaitEventSet::events, WaitEventSet::nevents, WaitEventSet::owner, pfree(), ReleaseExternalFD(), ResourceOwnerForgetWaitEventSet(), WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), ResOwnerReleaseWaitEventSet(), and WaitLatchOrSocket().
| void FreeWaitEventSetAfterFork | ( | WaitEventSet * | set | ) |
Definition at line 524 of file waiteventset.c.
References close, pfree(), and ReleaseExternalFD().
Referenced by ClosePostmasterPorts().
| int GetNumRegisteredWaitEvents | ( | WaitEventSet * | set | ) |
Definition at line 1883 of file waiteventset.c.
References WaitEventSet::nevents.
Referenced by ExecAppendAsyncEventWait(), and postgresForeignAsyncConfigureWait().
| void InitializeWaitEventSupport | ( | void | ) |
Definition at line 241 of file waiteventset.c.
References Assert(), close, elog, FATAL, IsUnderPostmaster, latch_sigurg_handler(), MyProcPid, pqsignal, ReleaseExternalFD(), ReserveExternalFD(), selfpipe_owner_pid, selfpipe_readfd, selfpipe_writefd, and UnBlockSig.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
|
static |
Definition at line 1896 of file waiteventset.c.
References sendSelfPipeByte(), and waiting.
Referenced by InitializeWaitEventSupport().
| void ModifyWaitEvent | ( | WaitEventSet * | set, |
| int | pos, | ||
| uint32 | events, | ||
| Latch * | latch | ||
| ) |
Definition at line 656 of file waiteventset.c.
References Assert(), elog, ERROR, WaitEventSet::events, WaitEvent::events, WaitEventSet::exit_on_postmaster_death, WaitEventSet::latch, MyProcPid, Latch::owner_pid, WaitEventAdjustPoll(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by pq_check_connection(), secure_read(), secure_write(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), WaitLatch(), and WalSndWait().
|
inlinestatic |
Definition at line 228 of file waiteventset.c.
References PointerGetDatum(), ResourceOwnerForget(), and wait_event_set_resowner_desc.
Referenced by FreeWaitEventSet().
|
inlinestatic |
Definition at line 223 of file waiteventset.c.
References PointerGetDatum(), ResourceOwnerRemember(), and wait_event_set_resowner_desc.
Referenced by CreateWaitEventSet().
|
static |
Definition at line 1997 of file waiteventset.c.
References Assert(), DatumGetPointer(), FreeWaitEventSet(), and WaitEventSet::owner.
|
static |
Definition at line 1904 of file waiteventset.c.
References EAGAIN, EINTR, EWOULDBLOCK, selfpipe_writefd, and write.
Referenced by latch_sigurg_handler(), and WakeupMyProc().
|
static |
Definition at line 790 of file waiteventset.c.
References Assert(), WaitEvent::events, WaitEvent::fd, WaitEventSet::latch, PGINVALID_SOCKET, WaitEventSet::pollfds, WL_LATCH_SET, WL_POSTMASTER_DEATH, WL_SOCKET_CLOSED, WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by AddWaitEventToSet(), and ModifyWaitEvent().
| bool WaitEventSetCanReportClosed | ( | void | ) |
Definition at line 1868 of file waiteventset.c.
Referenced by check_client_connection_check_interval().
| int WaitEventSetWait | ( | WaitEventSet * | set, |
| long | timeout, | ||
| WaitEvent * | occurred_events, | ||
| int | nevents, | ||
| uint32 | wait_event_info | ||
| ) |
Definition at line 1038 of file waiteventset.c.
References Assert(), WaitEventSet::events, WaitEvent::events, WaitEvent::fd, INSTR_TIME_GET_MILLISEC, INSTR_TIME_SET_CURRENT, INSTR_TIME_SET_ZERO, INSTR_TIME_SUBTRACT, Latch::is_set, WaitEventSet::latch, WaitEventSet::latch_pos, Latch::maybe_sleeping, pg_memory_barrier, PGINVALID_SOCKET, pgstat_report_wait_end(), pgstat_report_wait_start(), pgwin32_dispatch_queued_signals(), WaitEvent::pos, start_time, WaitEvent::user_data, WaitEventSetWaitBlock(), waiting, and WL_LATCH_SET.
Referenced by ExecAppendAsyncEventWait(), pq_check_connection(), secure_read(), secure_write(), ServerLoop(), SysLoggerMain(), WaitLatch(), WaitLatchOrSocket(), and WalSndWait().
|
inlinestatic |
Definition at line 1471 of file waiteventset.c.
References Assert(), drain(), EINTR, ereport, errcode_for_socket_access(), errmsg(), ERROR, WaitEventSet::events, WaitEvent::events, WaitEventSet::exit_on_postmaster_death, WaitEvent::fd, Latch::is_set, WaitEventSet::latch, Latch::maybe_sleeping, WaitEventSet::nevents, PGINVALID_SOCKET, WaitEventSet::pollfds, WaitEvent::pos, PostmasterIsAliveInternal(), proc_exit(), WaitEvent::user_data, waiting, WL_LATCH_SET, WL_POSTMASTER_DEATH, WL_SOCKET_CLOSED, WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by WaitEventSetWait().
| void WakeupMyProc | ( | void | ) |
Definition at line 2020 of file waiteventset.c.
References kill, MyProcPid, sendSelfPipeByte(), and waiting.
Referenced by SetLatch().
| void WakeupOtherProc | ( | int | pid | ) |
|
static |
Definition at line 185 of file waiteventset.c.
Referenced by InitializeWaitEventSupport().
|
static |
Definition at line 181 of file waiteventset.c.
Referenced by AddWaitEventToSet(), drain(), and InitializeWaitEventSupport().
|
static |
Definition at line 182 of file waiteventset.c.
Referenced by InitializeWaitEventSupport(), and sendSelfPipeByte().
|
static |
Definition at line 212 of file waiteventset.c.
Referenced by ResourceOwnerForgetWaitEventSet(), and ResourceOwnerRememberWaitEventSet().
|
static |
Definition at line 171 of file waiteventset.c.
Referenced by drain(), latch_sigurg_handler(), LockBufferForCleanup(), ResolveRecoveryConflictWithVirtualXIDs(), run_permutation(), try_complete_step(), try_complete_steps(), WaitEventSetWait(), WaitEventSetWaitBlock(), and WakeupMyProc().