|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <poll.h>#include <signal.h>#include <fcntl.h>#include <grp.h>#include <unistd.h>#include <sys/file.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/time.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <utime.h>#include "common/ip.h"#include "libpq/libpq.h"#include "miscadmin.h"#include "port/pg_bswap.h"#include "postmaster/postmaster.h"#include "storage/ipc.h"#include "storage/latch.h"#include "utils/guc_hooks.h"#include "utils/memutils.h"
Go to the source code of this file.
Macros | |
| #define | PQ_SEND_BUFFER_SIZE 8192 |
| #define | PQ_RECV_BUFFER_SIZE 8192 |
| int AcceptConnection | ( | pgsocket | server_fd, |
| ClientSocket * | client_sock | ||
| ) |
Definition at line 795 of file pqcomm.c.
References accept, ereport, errcode_for_socket_access(), errmsg(), fb(), LOG, pg_usleep(), PGINVALID_SOCKET, STATUS_ERROR, and STATUS_OK.
Referenced by ServerLoop().
Definition at line 2011 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivescount().
Definition at line 1955 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivesidle().
Definition at line 1988 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivesinterval().
Definition at line 2034 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_settcpusertimeout().
Definition at line 1350 of file pqcomm.c.
References internal_flush_buffer(), PqSendBuffer, PqSendPointer, and PqSendStart.
Referenced by internal_putbytes(), socket_flush(), and socket_flush_if_writable().
|
static |
Definition at line 1363 of file pqcomm.c.
References buf, ClientConnectionLost, COMMERROR, EAGAIN, EINTR, ereport, errcode_for_socket_access(), errmsg(), EWOULDBLOCK, fb(), InterruptPending, MyProcPort, secure_write(), and start.
Referenced by internal_flush(), and internal_putbytes().
Definition at line 1278 of file pqcomm.c.
References b, fb(), internal_flush(), internal_flush_buffer(), len, PqSendBuffer, PqSendBufferSize, PqSendPointer, PqSendStart, socket_set_nonblocking(), and start.
Referenced by pq_putmessage_v2(), and socket_putmessage().
| int ListenServerPort | ( | int | family, |
| const char * | hostName, | ||
| unsigned short | portNumber, | ||
| const char * | unixSocketDir, | ||
| pgsocket | ListenSockets[], | ||
| int * | NumListenSockets, | ||
| int | MaxListen | ||
| ) |
Definition at line 419 of file pqcomm.c.
References _, bind, closesocket, EADDRINUSE, elog, ereport, err(), errcode_for_socket_access(), errhint(), errmsg(), FATAL, fb(), fd(), gai_strerror(), listen, ListenSockets, Lock_AF_UNIX(), LOG, MaxConnections, MAXPGPATH, MemSet, NumListenSockets, pg_freeaddrinfo_all(), pg_getaddrinfo_all(), pg_getnameinfo_all(), PGINVALID_SOCKET, Setup_AF_UNIX(), snprintf, socket, STATUS_ERROR, STATUS_OK, UNIXSOCK_PATH, and UNIXSOCK_PATH_BUFLEN.
Referenced by PostmasterMain().
Definition at line 686 of file pqcomm.c.
References CreateSocketLockFile(), fb(), lappend(), pstrdup(), sock_paths, and STATUS_OK.
Referenced by ListenServerPort().
Definition at line 1128 of file pqcomm.c.
References Assert, PqRecvLength, and PqRecvPointer.
Referenced by ProcessStartupPacket(), and secure_open_server().
Definition at line 2057 of file pqcomm.c.
References fb(), FeBeWaitSet, FeBeWaitSetNEvents, FeBeWaitSetSocketPos, i, lengthof, ModifyWaitEvent(), MyLatch, ResetLatch(), WaitEventSetWait(), WL_LATCH_SET, and WL_SOCKET_CLOSED.
Referenced by ProcessInterrupts().
Definition at line 1098 of file pqcomm.c.
References Assert, fb(), len, pq_recvbuf(), PqCommReadingMsg, PqRecvLength, and PqRecvPointer.
Referenced by pq_getmessage().
Definition at line 1166 of file pqcomm.c.
References Assert, and PqCommReadingMsg.
Referenced by ProcessRepliesIfAny(), ProcessSSLStartup(), ProcessStartupPacket(), and secure_open_server().
Definition at line 964 of file pqcomm.c.
References Assert, fb(), pq_recvbuf(), PqCommReadingMsg, PqRecvBuffer, PqRecvLength, and PqRecvPointer.
Referenced by CheckSASLAuth(), CopyGetData(), HandleUploadManifestPacket(), recv_password_packet(), and SocketBackend().
Definition at line 1004 of file pqcomm.c.
References Assert, COMMERROR, EAGAIN, EINTR, ereport, errcode_for_socket_access(), errmsg(), EWOULDBLOCK, fb(), MyProcPort, PqCommReadingMsg, PqRecvBuffer, PqRecvLength, PqRecvPointer, secure_read(), and socket_set_nonblocking().
Referenced by ProcessRepliesIfAny().
Definition at line 1063 of file pqcomm.c.
References Assert, b, fb(), len, pq_recvbuf(), PqCommReadingMsg, PqRecvBuffer, PqRecvLength, and PqRecvPointer.
Referenced by pq_getmessage(), ProcessStartupPacket(), and secure_open_server().
Definition at line 1802 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_setkeepalivescount(), and show_tcp_keepalives_count().
Definition at line 1633 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_setkeepalivesidle(), and show_tcp_keepalives_idle().
Definition at line 1718 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_setkeepalivesinterval(), and show_tcp_keepalives_interval().
| int pq_getmessage | ( | StringInfo | s, |
| int | maxlen | ||
| ) |
Definition at line 1204 of file pqcomm.c.
References Assert, COMMERROR, StringInfoData::data, enlargeStringInfo(), ereport, errcode(), ERRCODE_PROTOCOL_VIOLATION, errmsg(), fb(), StringInfoData::len, len, PG_CATCH, PG_END_TRY, pg_ntoh32, PG_RE_THROW, PG_TRY, pq_discardbytes(), pq_getbytes(), PqCommReadingMsg, and resetStringInfo().
Referenced by CheckSASLAuth(), CopyGetData(), HandleUploadManifestPacket(), ProcessRepliesIfAny(), recv_password_packet(), and SocketBackend().
Definition at line 1877 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_settcpusertimeout(), and show_tcp_user_timeout().
| Port * pq_init | ( | ClientSocket * | client_sock | ) |
Definition at line 175 of file pqcomm.c.
References AddWaitEventToSet(), Assert, CreateWaitEventSet(), elog, ereport, errmsg(), FATAL, fb(), FeBeWaitSet, FeBeWaitSetLatchPos, FeBeWaitSetNEvents, FeBeWaitSetSocketPos, MemoryContextAlloc(), MyLatch, on_proc_exit(), palloc0_object, pg_set_noblock(), PG_USED_FOR_ASSERTS_ONLY, PGINVALID_SOCKET, port, PQ_SEND_BUFFER_SIZE, pq_setkeepalivescount(), pq_setkeepalivesidle(), pq_setkeepalivesinterval(), pq_settcpusertimeout(), PqCommBusy, PqCommReadingMsg, PqRecvLength, PqRecvPointer, PqSendBuffer, PqSendBufferSize, PqSendPointer, PqSendStart, socket_close(), tcp_keepalives_count, tcp_keepalives_idle, tcp_keepalives_interval, tcp_user_timeout, TopMemoryContext, WL_LATCH_SET, WL_POSTMASTER_DEATH, and WL_SOCKET_WRITEABLE.
Referenced by BackendInitialize().
Definition at line 1182 of file pqcomm.c.
References PqCommReadingMsg.
Referenced by PostgresMain().
Definition at line 983 of file pqcomm.c.
References Assert, fb(), pq_recvbuf(), PqCommReadingMsg, PqRecvBuffer, PqRecvLength, and PqRecvPointer.
Referenced by ProcessSSLStartup().
Definition at line 1562 of file pqcomm.c.
References Assert, fb(), internal_putbytes(), len, and PqCommBusy.
Referenced by send_message_to_frontend().
Definition at line 898 of file pqcomm.c.
References COMMERROR, EINTR, ereport, errcode_for_socket_access(), errmsg(), fb(), MyProcPort, PQ_RECV_BUFFER_SIZE, PqRecvBuffer, PqRecvLength, PqRecvPointer, secure_read(), and socket_set_nonblocking().
Referenced by pq_discardbytes(), pq_getbyte(), pq_getbytes(), and pq_peekbyte().
Definition at line 1832 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, port, pq_getkeepalivescount(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_count(), and pq_init().
Definition at line 1668 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, port, pq_getkeepalivesidle(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_idle(), and pq_init().
Definition at line 1753 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, port, pq_getkeepalivesinterval(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_interval(), and pq_init().
Definition at line 1907 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, port, pq_gettcpusertimeout(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_user_timeout(), and pq_init().
Definition at line 1142 of file pqcomm.c.
References ereport, errcode(), ERRCODE_PROTOCOL_VIOLATION, errmsg(), FATAL, and PqCommReadingMsg.
Referenced by CheckSASLAuth(), CopyGetData(), HandleUploadManifestPacket(), ProcessRepliesIfAny(), ProcessSSLStartup(), ProcessStartupPacket(), recv_password_packet(), secure_open_server(), and SocketBackend().
Definition at line 849 of file pqcomm.c.
References fb(), lfirst, and sock_paths.
Referenced by CloseServerPorts().
Definition at line 721 of file pqcomm.c.
References Assert, elog, ereport, errcode_for_file_access(), errmsg(), fb(), LOG, STATUS_ERROR, STATUS_OK, Unix_socket_group, Unix_socket_permissions, val, and WARNING.
Referenced by ListenServerPort().
Definition at line 2021 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivescount(), and snprintf.
Definition at line 1975 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivesidle(), and snprintf.
Definition at line 1998 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivesinterval(), and snprintf.
Definition at line 2044 of file pqcomm.c.
References fb(), MyProcPort, pq_gettcpusertimeout(), and snprintf.
Definition at line 350 of file pqcomm.c.
References fb(), Port::gss, MyProcPort, PGINVALID_SOCKET, secure_close(), and Port::sock.
Referenced by pq_init().
Definition at line 335 of file pqcomm.c.
References PqCommBusy.
Definition at line 1328 of file pqcomm.c.
References internal_flush(), PqCommBusy, and socket_set_nonblocking().
Definition at line 1436 of file pqcomm.c.
References internal_flush(), PqCommBusy, PqSendPointer, PqSendStart, and socket_set_nonblocking().
Definition at line 1462 of file pqcomm.c.
References PqSendPointer, and PqSendStart.
Definition at line 1492 of file pqcomm.c.
References Assert, fb(), internal_putbytes(), len, pg_hton32, and PqCommBusy.
Definition at line 1525 of file pqcomm.c.
References Assert, fb(), len, PG_USED_FOR_ASSERTS_ONLY, pq_putmessage, PqSendBuffer, PqSendBufferSize, PqSendPointer, and repalloc().
Definition at line 881 of file pqcomm.c.
References ereport, errcode(), errmsg(), ERROR, fb(), MyProcPort, and Port::noblock.
Referenced by internal_putbytes(), pq_getbyte_if_available(), pq_recvbuf(), socket_flush(), and socket_flush_if_writable().
Definition at line 831 of file pqcomm.c.
References fb(), lfirst, and sock_paths.
Referenced by ServerLoop().
| WaitEventSet* FeBeWaitSet |
Definition at line 167 of file pqcomm.c.
Referenced by pq_check_connection(), pq_init(), secure_read(), secure_write(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), and WalSndWait().
|
static |
Definition at line 135 of file pqcomm.c.
Referenced by pq_init(), pq_putmessage_v2(), socket_comm_reset(), socket_flush(), socket_flush_if_writable(), and socket_putmessage().
| const PQcommMethods* PqCommMethods = &PqCommSocketMethods |
Definition at line 165 of file pqcomm.c.
Referenced by pq_redirect_to_shm_mq(), and pq_set_parallel_leader().
|
static |
Definition at line 136 of file pqcomm.c.
Referenced by pq_discardbytes(), pq_endmsgread(), pq_getbyte(), pq_getbyte_if_available(), pq_getbytes(), pq_getmessage(), pq_init(), pq_is_reading_msg(), pq_peekbyte(), and pq_startmsgread().
|
static |
Definition at line 156 of file pqcomm.c.
|
static |
Definition at line 128 of file pqcomm.c.
Referenced by pq_getbyte(), pq_getbyte_if_available(), pq_getbytes(), pq_peekbyte(), and pq_recvbuf().
|
static |
Definition at line 130 of file pqcomm.c.
Referenced by pq_buffer_remaining_data(), pq_discardbytes(), pq_getbyte(), pq_getbyte_if_available(), pq_getbytes(), pq_init(), pq_peekbyte(), and pq_recvbuf().
|
static |
Definition at line 129 of file pqcomm.c.
Referenced by pq_buffer_remaining_data(), pq_discardbytes(), pq_getbyte(), pq_getbyte_if_available(), pq_getbytes(), pq_init(), pq_peekbyte(), and pq_recvbuf().
|
static |
Definition at line 123 of file pqcomm.c.
Referenced by internal_flush(), internal_putbytes(), pq_init(), and socket_putmessage_noblock().
|
static |
Definition at line 124 of file pqcomm.c.
Referenced by internal_putbytes(), pq_init(), and socket_putmessage_noblock().
|
static |
Definition at line 125 of file pqcomm.c.
Referenced by internal_flush(), internal_putbytes(), pq_init(), socket_flush_if_writable(), socket_is_send_pending(), and socket_putmessage_noblock().
|
static |
Definition at line 126 of file pqcomm.c.
Referenced by internal_flush(), internal_putbytes(), pq_init(), socket_flush_if_writable(), and socket_is_send_pending().
Definition at line 111 of file pqcomm.c.
Referenced by Lock_AF_UNIX(), RemoveSocketFiles(), and TouchSocketFiles().
| char* Unix_socket_group |
Definition at line 108 of file pqcomm.c.
Referenced by Setup_AF_UNIX().
| int Unix_socket_permissions |
Definition at line 107 of file pqcomm.c.
Referenced by Setup_AF_UNIX(), and show_unix_socket_permissions().