PostgreSQL Source Code git master
Loading...
Searching...
No Matches
oauth-utils.c File Reference
#include "postgres_fe.h"
#include <signal.h>
#include "oauth-utils.h"
Include dependency graph for oauth-utils.c:

Go to the source code of this file.

Macros

#define SOCK_ERRNO   errno
 
#define SOCK_ERRNO_SET(e)   (errno = (e))
 

Functions

void libpq_oauth_init (libpq_gettext_func gettext_impl)
 
int pq_block_sigpipe (sigset_t *osigset, bool *sigpipe_pending)
 
void pq_reset_sigpipe (sigset_t *osigset, bool sigpipe_pending, bool got_epipe)
 

Variables

pgthreadlock_t pg_g_threadlock
 
static libpq_gettext_func libpq_gettext_impl
 

Macro Definition Documentation

◆ SOCK_ERRNO

#define SOCK_ERRNO   errno

Definition at line 86 of file oauth-utils.c.

◆ SOCK_ERRNO_SET

#define SOCK_ERRNO_SET (   e)    (errno = (e))

Definition at line 87 of file oauth-utils.c.

Function Documentation

◆ libpq_oauth_init()

void libpq_oauth_init ( libpq_gettext_func  gettext_impl)

Definition at line 46 of file oauth-utils.c.

47{
50}
pgthreadlock_t PQgetThreadLock(void)
static libpq_gettext_func libpq_gettext_impl
Definition oauth-utils.c:36
pgthreadlock_t pg_g_threadlock
Definition oauth-utils.c:35
static int fb(int x)

References fb(), libpq_gettext_impl, pg_g_threadlock, and PQgetThreadLock().

◆ pq_block_sigpipe()

int pq_block_sigpipe ( sigset_t osigset,
bool sigpipe_pending 
)

Definition at line 94 of file oauth-utils.c.

95{
98
101
102 /* Block SIGPIPE and save previous mask for later reset */
104 if (SOCK_ERRNO)
105 return -1;
106
107 /* We can have a pending SIGPIPE only if it was blocked before */
109 {
110 /* Is there a pending SIGPIPE? */
111 if (sigpending(&sigset) != 0)
112 return -1;
113
115 *sigpipe_pending = true;
116 else
117 *sigpipe_pending = false;
118 }
119 else
120 *sigpipe_pending = false;
121
122 return 0;
123}
#define SOCK_ERRNO
Definition oauth-utils.c:86
#define SOCK_ERRNO_SET(e)
Definition oauth-utils.c:87
#define SIGPIPE
Definition win32_port.h:163

References fb(), SIGPIPE, SOCK_ERRNO, and SOCK_ERRNO_SET.

Referenced by pg_fe_run_oauth_flow(), and PQprint().

◆ pq_reset_sigpipe()

void pq_reset_sigpipe ( sigset_t osigset,
bool  sigpipe_pending,
bool  got_epipe 
)

Definition at line 130 of file oauth-utils.c.

131{
133 int signo;
135
136 /* Clear SIGPIPE only if none was pending */
137 if (got_epipe && !sigpipe_pending)
138 {
139 if (sigpending(&sigset) == 0 &&
141 {
143
146
148 }
149 }
150
151 /* Restore saved block mask */
153
155}

References fb(), SIGPIPE, SOCK_ERRNO, and SOCK_ERRNO_SET.

Referenced by pg_fe_run_oauth_flow(), and PQprint().

Variable Documentation

◆ libpq_gettext_impl

libpq_gettext_func libpq_gettext_impl
static

Definition at line 36 of file oauth-utils.c.

Referenced by libpq_oauth_init().

◆ pg_g_threadlock

pgthreadlock_t pg_g_threadlock

Definition at line 35 of file oauth-utils.c.

Referenced by libpq_oauth_init().