translation_unit
comment "/*----------------------------------------------------------"...
comment "/*------------------------\n * INTERFACE ROUTINES\n *\n * setup"...
preproc_include
#include "#include"
string_literal
" "\""
string_content "postgres.h"
" "\""
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_POLL_H"
preproc_include
#include "#include"
system_lib_string "<poll.h>"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<signal.h>"
preproc_include
#include "#include"
system_lib_string "<fcntl.h>"
preproc_include
#include "#include"
system_lib_string "<grp.h>"
preproc_include
#include "#include"
system_lib_string "<unistd.h>"
preproc_include
#include "#include"
system_lib_string "<sys/file.h>"
preproc_include
#include "#include"
system_lib_string "<sys/socket.h>"
preproc_include
#include "#include"
system_lib_string "<sys/stat.h>"
preproc_include
#include "#include"
system_lib_string "<sys/time.h>"
preproc_include
#include "#include"
system_lib_string "<netdb.h>"
preproc_include
#include "#include"
system_lib_string "<netinet/in.h>"
preproc_include
#include "#include"
system_lib_string "<netinet/tcp.h>"
preproc_include
#include "#include"
system_lib_string "<utime.h>"
preproc_ifdef
#ifdef "#ifdef"
identifier "WIN32"
preproc_include
#include "#include"
system_lib_string "<mstcpip.h>"
#endif "#endif"
preproc_include
#include "#include"
string_literal
" "\""
string_content "common/ip.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "libpq/libpq.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "miscadmin.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "port/pg_bswap.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "postmaster/postmaster.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "storage/ipc.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "utils/guc_hooks.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "utils/memutils.h"
" "\""
comment "/*\n * Cope with the various platform-specific ways to spell "...
preproc_if (+60 nodes collapsed)
comment "/*\n * Configuration options\n */"
declaration
primitive_type "int"
identifier "Unix_socket_permissions"
; ";"
declaration
primitive_type "char"
pointer_declarator
* "*"
identifier "Unix_socket_group"
; ";"
comment "/* Where the Unix socket files are (list of palloc'd strings"...
declaration
storage_class_specifier
static "static"
type_identifier "List"
init_declarator
pointer_declarator
* "*"
identifier "sock_paths"
= "="
identifier "NIL"
; ";"
comment "/*\n * Buffers for low-level I/O.\n *\n * The receive buffer is"...
preproc_def
#define "#define"
identifier "PQ_SEND_BUFFER_SIZE"
preproc_arg "8192"
preproc_def
#define "#define"
identifier "PQ_RECV_BUFFER_SIZE"
preproc_arg "8192"
declaration
storage_class_specifier
static "static"
primitive_type "char"
pointer_declarator
* "*"
identifier "PqSendBuffer"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "int"
identifier "PqSendBufferSize"
; ";"
comment "/* Size send buffer */"
declaration
storage_class_specifier
static "static"
primitive_type "size_t"
identifier "PqSendPointer"
; ";"
comment "/* Next index to store a byte in PqSendBuffer */"
declaration
storage_class_specifier
static "static"
primitive_type "size_t"
identifier "PqSendStart"
; ";"
comment "/* Next index to send a byte in PqSendBuffer */"
declaration
storage_class_specifier
static "static"
primitive_type "char"
array_declarator
identifier "PqRecvBuffer"
[ "["
identifier "PQ_RECV_BUFFER_SIZE"
] "]"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "int"
identifier "PqRecvPointer"
; ";"
comment "/* Next index to read a byte from PqRecvBuffer */"
declaration
storage_class_specifier
static "static"
primitive_type "int"
identifier "PqRecvLength"
; ";"
comment "/* End of data available in PqRecvBuffer */"
comment "/*\n * Message status\n */"
declaration
storage_class_specifier
static "static"
primitive_type "bool"
identifier "PqCommBusy"
; ";"
comment "/* busy sending data to the client */"
declaration
storage_class_specifier
static "static"
primitive_type "bool"
identifier "PqCommReadingMsg"
; ";"
comment "/* in the middle of reading a message */"
comment "/* Internal functions */"
declaration
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "socket_comm_reset"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "socket_close"
parameter_list
( "("
parameter_declaration
primitive_type "int"
identifier "code"
, ","
parameter_declaration
type_identifier "Datum"
identifier "arg"
) ")"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "socket_set_nonblocking"
parameter_list
( "("
parameter_declaration
primitive_type "bool"
identifier "nonblocking"
) ")"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "int"
function_declarator
identifier "socket_flush"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "int"
function_declarator
identifier "socket_flush_if_writable"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "bool"
function_declarator
identifier "socket_is_send_pending"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
; ";"
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
declaration (+23 nodes collapsed)
declaration
storage_class_specifier
static "static"
storage_class_specifier
inline "inline"
primitive_type "int"
function_declarator
identifier "internal_flush"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
; ";"
declaration (+31 nodes collapsed)
declaration (+25 nodes collapsed)
declaration
storage_class_specifier
static "static"
primitive_type "int"
function_declarator
identifier "Setup_AF_UNIX"
parameter_list
( "("
parameter_declaration
type_qualifier
const "const"
primitive_type "char"
pointer_declarator
* "*"
identifier "sock_path"
) ")"
; ";"
declaration (+54 nodes collapsed)
declaration
type_qualifier
const "const"
type_identifier "PQcommMethods"
init_declarator
pointer_declarator
* "*"
identifier "PqCommMethods"
= "="
pointer_expression
& "&"
identifier "PqCommSocketMethods"
; ";"
declaration
type_identifier "WaitEventSet"
pointer_declarator
* "*"
identifier "FeBeWaitSet"
; ";"
comment "/* --------------------------------\n *\t\tpq_init - initialize"...
function_definition
type_identifier "Port"
pointer_declarator
* "*"
function_declarator
identifier "pq_init"
parameter_list
( "("
parameter_declaration
type_identifier "ClientSocket"
pointer_declarator
* "*"
identifier "client_sock"
) ")"
compound_statement
{ "{"
declaration
type_identifier "Port"
pointer_declarator
* "*"
identifier "port"
; ";"
declaration
primitive_type "int"
identifier "socket_pos"
; ""
expression_statement
identifier "PG_USED_FOR_ASSERTS_ONLY"
; ";"
declaration
primitive_type "int"
ERROR
identifier "latch_pos"
identifier "PG_USED_FOR_ASSERTS_ONLY"
; ";"
comment "/* allocate the Port struct and copy the ClientSocket conten"...
expression_statement
assignment_expression
identifier "port"
= "="
call_expression
identifier "palloc0"
argument_list
( "("
sizeof_expression
sizeof "sizeof"
parenthesized_expression
( "("
identifier "Port"
) ")"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
identifier "port"
-> "->"
field_identifier "sock"
= "="
field_expression
identifier "client_sock"
-> "->"
field_identifier "sock"
; ";"
expression_statement (+34 nodes collapsed)
expression_statement
assignment_expression
field_expression
field_expression
identifier "port"
-> "->"
field_identifier "raddr"
. "."
field_identifier "salen"
= "="
field_expression
field_expression
identifier "client_sock"
-> "->"
field_identifier "raddr"
. "."
field_identifier "salen"
; ";"
comment "/* fill in the server (local) address */"
expression_statement (+23 nodes collapsed)
if_statement (+75 nodes collapsed)
comment "/* select NODELAY and KEEPALIVE options if it's a TCP connec"...
if_statement (+444 nodes collapsed)
comment "/* initialize state variables */"
expression_statement
assignment_expression
identifier "PqSendBufferSize"
= "="
identifier "PQ_SEND_BUFFER_SIZE"
; ";"
expression_statement
assignment_expression
identifier "PqSendBuffer"
= "="
call_expression
identifier "MemoryContextAlloc"
argument_list
( "("
identifier "TopMemoryContext"
, ","
identifier "PqSendBufferSize"
) ")"
; ";"
expression_statement
assignment_expression
identifier "PqSendPointer"
= "="
assignment_expression
identifier "PqSendStart"
= "="
assignment_expression
identifier "PqRecvPointer"
= "="
assignment_expression
identifier "PqRecvLength"
= "="
number_literal "0"
; ";"
expression_statement
assignment_expression
identifier "PqCommBusy"
= "="
false "false"
; ";"
expression_statement
assignment_expression
identifier "PqCommReadingMsg"
= "="
false "false"
; ";"
comment "/* set up process-exit hook to close the socket */"
expression_statement
call_expression
identifier "on_proc_exit"
argument_list
( "("
identifier "socket_close"
, ","
number_literal "0"
) ")"
; ";"
comment "/*\n\t * In backends (as soon as forked) we operate the underl"...
preproc_ifdef (+41 nodes collapsed)
preproc_ifdef (+39 nodes collapsed)
expression_statement
assignment_expression
identifier "FeBeWaitSet"
= "="
call_expression
identifier "CreateWaitEventSet"
argument_list
( "("
null
NULL "NULL"
, ","
identifier "FeBeWaitSetNEvents"
) ")"
; ";"
expression_statement (+24 nodes collapsed)
expression_statement
assignment_expression
identifier "latch_pos"
= "="
call_expression
identifier "AddWaitEventToSet"
argument_list
( "("
identifier "FeBeWaitSet"
, ","
identifier "WL_LATCH_SET"
, ","
identifier "PGINVALID_SOCKET"
, ","
identifier "MyLatch"
, ","
null
NULL "NULL"
) ")"
; ";"
expression_statement
call_expression
identifier "AddWaitEventToSet"
argument_list
( "("
identifier "FeBeWaitSet"
, ","
identifier "WL_POSTMASTER_DEATH"
, ","
identifier "PGINVALID_SOCKET"
, ","
null
NULL "NULL"
, ","
null
NULL "NULL"
) ")"
; ";"
comment "/*\n\t * The event positions match the order we added them, bu"...
expression_statement
call_expression
identifier "Assert"
argument_list
( "("
binary_expression
identifier "socket_pos"
== "=="
identifier "FeBeWaitSetSocketPos"
) ")"
; ";"
expression_statement
call_expression
identifier "Assert"
argument_list
( "("
binary_expression
identifier "latch_pos"
== "=="
identifier "FeBeWaitSetLatchPos"
) ")"
; ";"
return_statement
return "return"
identifier "port"
; ";"
} "}"
comment "/* --------------------------------\n *\t\tsocket_comm_reset - "...
function_definition (+21 nodes collapsed)
comment "/* --------------------------------\n *\t\tsocket_close - shutd"...
function_definition (+147 nodes collapsed)
comment "/* --------------------------------\n * Postmaster functions "...
comment "/*\n * ListenServerPort -- open a \"listening\" port to accept "...
function_definition (+1512 nodes collapsed)
comment "/*\n * Lock_AF_UNIX -- configure unix socket file path\n */"
function_definition (+98 nodes collapsed)
comment "/*\n * Setup_AF_UNIX -- configure unix socket permissions\n */"
function_definition (+344 nodes collapsed)
comment "/*\n * AcceptConnection -- accept a new connection with clien"...
function_definition (+144 nodes collapsed)
comment "/*\n * TouchSocketFiles -- mark socket files as recently acce"...
function_definition (+70 nodes collapsed)
comment "/*\n * RemoveSocketFiles -- unlink socket files at postmaster"...
function_definition (+68 nodes collapsed)
comment "/* --------------------------------\n * Low-level I/O routine"...
comment "/* --------------------------------\n *\t\t\t socket_set_nonblo"...
function_definition (+63 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_recvbuf - load so"...
function_definition (+225 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_getbyte\t- get a s"...
function_definition (+65 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_peekbyte\t\t- peek "...
function_definition (+63 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_getbyte_if_availa"...
function_definition (+203 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_getbytes\t\t- get a"...
function_definition (+141 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_discardbytes\t\t- t"...
function_definition (+107 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_buffer_remaining_"...
function_definition (+33 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_startmsgread - be"...
function_definition (+54 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_endmsgread\t- fini"...
function_definition (+26 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_is_reading_msg - "...
function_definition
primitive_type "bool"
function_declarator
identifier "pq_is_reading_msg"
parameter_list
( "("
parameter_declaration
primitive_type "void"
) ")"
compound_statement
{ "{"
return_statement
return "return"
identifier "PqCommReadingMsg"
; ";"
} "}"
comment "/* --------------------------------\n *\t\tpq_getmessage\t- get "...
function_definition (+361 nodes collapsed)
function_definition (+207 nodes collapsed)
comment "/* --------------------------------\n *\t\tsocket_flush\t\t- flus"...
function_definition (+63 nodes collapsed)
comment "/* --------------------------------\n *\t\tinternal_flush - flu"...
function_definition (+33 nodes collapsed)
comment "/* --------------------------------\n *\t\tinternal_flush_buffe"...
function_definition (+271 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_flush_if_writable"...
function_definition (+78 nodes collapsed)
comment "/* --------------------------------\n *\tsocket_is_send_pendin"...
function_definition (+24 nodes collapsed)
comment "/* --------------------------------\n * Message-level I/O rou"...
comment "/* --------------------------------\n *\t\tsocket_putmessage - "...
function_definition (+158 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_putmessage_nobloc"...
function_definition (+111 nodes collapsed)
comment "/* --------------------------------\n *\t\tpq_putmessage_v2 - s"...
function_definition (+111 nodes collapsed)
comment "/*\n * Support for TCP Keepalive parameters\n */"
comment "/*\n * On Windows, we need to set both idle and interval at t"...
preproc_if (+261 nodes collapsed)
function_definition (+220 nodes collapsed)
function_definition (+300 nodes collapsed)
function_definition (+222 nodes collapsed)
function_definition (+312 nodes collapsed)
function_definition (+193 nodes collapsed)
function_definition (+277 nodes collapsed)
function_definition (+193 nodes collapsed)
function_definition (+277 nodes collapsed)
comment "/*\n * GUC assign_hook for tcp_keepalives_idle\n */"
function_definition (+35 nodes collapsed)
comment "/*\n * GUC show_hook for tcp_keepalives_idle\n */"
function_definition (+58 nodes collapsed)
comment "/*\n * GUC assign_hook for tcp_keepalives_interval\n */"
function_definition (+35 nodes collapsed)
comment "/*\n * GUC show_hook for tcp_keepalives_interval\n */"
function_definition (+58 nodes collapsed)
comment "/*\n * GUC assign_hook for tcp_keepalives_count\n */"
function_definition (+35 nodes collapsed)
comment "/*\n * GUC show_hook for tcp_keepalives_count\n */"
function_definition (+58 nodes collapsed)
comment "/*\n * GUC assign_hook for tcp_user_timeout\n */"
function_definition (+35 nodes collapsed)
comment "/*\n * GUC show_hook for tcp_user_timeout\n */"
function_definition (+58 nodes collapsed)
comment "/*\n * Check if the client is still connected.\n */"
function_definition (+145 nodes collapsed)