|
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 "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 794 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 2010 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivescount().
Definition at line 1954 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivesidle().
Definition at line 1987 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_setkeepalivesinterval().
Definition at line 2033 of file pqcomm.c.
References fb(), MyProcPort, newval, and pq_settcpusertimeout().
Definition at line 1349 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 1362 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 1277 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 418 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 685 of file pqcomm.c.
References CreateSocketLockFile(), fb(), lappend(), pstrdup(), sock_paths, and STATUS_OK.
Referenced by ListenServerPort().
Definition at line 1127 of file pqcomm.c.
References Assert, PqRecvLength, and PqRecvPointer.
Referenced by ProcessStartupPacket(), and secure_open_server().
Definition at line 2056 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 1097 of file pqcomm.c.
References Assert, fb(), len, pq_recvbuf(), PqCommReadingMsg, PqRecvLength, and PqRecvPointer.
Referenced by pq_getmessage().
Definition at line 1165 of file pqcomm.c.
References Assert, and PqCommReadingMsg.
Referenced by ProcessRepliesIfAny(), ProcessSSLStartup(), ProcessStartupPacket(), and secure_open_server().
Definition at line 963 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 1003 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 1062 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 1801 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_setkeepalivescount(), and show_tcp_keepalives_count().
Definition at line 1632 of file pqcomm.c.
References ereport, errmsg(), fb(), LOG, and port.
Referenced by pq_setkeepalivesidle(), and show_tcp_keepalives_idle().
Definition at line 1717 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 1203 of file pqcomm.c.
References Assert, COMMERROR, StringInfoData::data, enlargeStringInfo(), ereport, errcode(), 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 1876 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 174 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 1181 of file pqcomm.c.
References PqCommReadingMsg.
Referenced by PostgresMain().
Definition at line 982 of file pqcomm.c.
References Assert, fb(), pq_recvbuf(), PqCommReadingMsg, PqRecvBuffer, PqRecvLength, and PqRecvPointer.
Referenced by ProcessSSLStartup().
Definition at line 1561 of file pqcomm.c.
References Assert, fb(), internal_putbytes(), len, and PqCommBusy.
Referenced by send_message_to_frontend().
Definition at line 897 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 1831 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 1667 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 1752 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 1906 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 1141 of file pqcomm.c.
References ereport, errcode(), errmsg(), FATAL, fb(), and PqCommReadingMsg.
Referenced by CheckSASLAuth(), CopyGetData(), HandleUploadManifestPacket(), ProcessRepliesIfAny(), ProcessSSLStartup(), ProcessStartupPacket(), recv_password_packet(), secure_open_server(), and SocketBackend().
Definition at line 848 of file pqcomm.c.
References fb(), lfirst, and sock_paths.
Referenced by CloseServerPorts().
Definition at line 720 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 2020 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivescount(), and snprintf.
Definition at line 1974 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivesidle(), and snprintf.
Definition at line 1997 of file pqcomm.c.
References fb(), MyProcPort, pq_getkeepalivesinterval(), and snprintf.
Definition at line 2043 of file pqcomm.c.
References fb(), MyProcPort, pq_gettcpusertimeout(), and snprintf.
Definition at line 349 of file pqcomm.c.
References fb(), Port::gss, MyProcPort, PGINVALID_SOCKET, secure_close(), and Port::sock.
Referenced by pq_init().
Definition at line 334 of file pqcomm.c.
References PqCommBusy.
Definition at line 1327 of file pqcomm.c.
References internal_flush(), PqCommBusy, and socket_set_nonblocking().
Definition at line 1435 of file pqcomm.c.
References internal_flush(), PqCommBusy, PqSendPointer, PqSendStart, and socket_set_nonblocking().
Definition at line 1461 of file pqcomm.c.
References PqSendPointer, and PqSendStart.
Definition at line 1491 of file pqcomm.c.
References Assert, fb(), internal_putbytes(), len, pg_hton32, and PqCommBusy.
Definition at line 1524 of file pqcomm.c.
References Assert, fb(), len, PG_USED_FOR_ASSERTS_ONLY, pq_putmessage, PqSendBuffer, PqSendBufferSize, PqSendPointer, and repalloc().
Definition at line 880 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 830 of file pqcomm.c.
References fb(), lfirst, and sock_paths.
Referenced by ServerLoop().
| WaitEventSet* FeBeWaitSet |
Definition at line 166 of file pqcomm.c.
Referenced by pq_check_connection(), pq_init(), secure_read(), secure_write(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), and WalSndWait().
|
static |
Definition at line 134 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 164 of file pqcomm.c.
Referenced by pq_redirect_to_shm_mq(), and pq_set_parallel_leader().
|
static |
Definition at line 135 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 155 of file pqcomm.c.
|
static |
Definition at line 127 of file pqcomm.c.
Referenced by pq_getbyte(), pq_getbyte_if_available(), pq_getbytes(), 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 128 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 122 of file pqcomm.c.
Referenced by internal_flush(), internal_putbytes(), pq_init(), and socket_putmessage_noblock().
|
static |
Definition at line 123 of file pqcomm.c.
Referenced by internal_putbytes(), pq_init(), and socket_putmessage_noblock().
|
static |
Definition at line 124 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 125 of file pqcomm.c.
Referenced by internal_flush(), internal_putbytes(), pq_init(), socket_flush_if_writable(), and socket_is_send_pending().
Definition at line 110 of file pqcomm.c.
Referenced by Lock_AF_UNIX(), RemoveSocketFiles(), and TouchSocketFiles().
| char* Unix_socket_group |
Definition at line 107 of file pqcomm.c.
Referenced by Setup_AF_UNIX().
| int Unix_socket_permissions |
Definition at line 106 of file pqcomm.c.
Referenced by Setup_AF_UNIX(), and show_unix_socket_permissions().