PostgreSQL Source Code  git master
c.h File Reference
#include "postgres_ext.h"
#include "pg_config.h"
#include "pg_config_manual.h"
#include "pg_config_os.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/types.h>
#include <errno.h>
#include <locale.h>
#include "port.h"
Include dependency graph for c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  varlena
 
struct  int2vector
 
struct  oidvector
 
struct  nameData
 
union  PGAlignedBlock
 
union  PGIOAlignedBlock
 
union  PGAlignedXLogBlock
 

Macros

#define __has_attribute(attribute)   0
 
#define pg_attribute_unused()
 
#define pg_nodiscard
 
#define pg_attribute_no_sanitize_alignment()
 
#define pg_attribute_nonnull(...)
 
#define PG_USED_FOR_ASSERTS_ONLY   pg_attribute_unused()
 
#define pg_attribute_format_arg(a)
 
#define pg_attribute_printf(f, a)
 
#define pg_attribute_noreturn()
 
#define pg_attribute_always_inline   inline
 
#define pg_noinline
 
#define pg_attribute_cold
 
#define pg_attribute_hot
 
#define pg_unreachable()   abort()
 
#define likely(x)   ((x) != 0)
 
#define unlikely(x)   ((x) != 0)
 
#define CppAsString(identifier)   #identifier
 
#define CppAsString2(x)   CppAsString(x)
 
#define CppConcat(x, y)   x##y
 
#define VA_ARGS_NARGS(...)
 
#define VA_ARGS_NARGS_(_01, _02, _03, _04, _05, _06, _07, _08, _09, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...)    (N)
 
#define FLEXIBLE_ARRAY_MEMBER   /* empty */
 
#define true   ((bool) 1)
 
#define false   ((bool) 0)
 
#define INT64_FORMAT   "%" INT64_MODIFIER "d"
 
#define UINT64_FORMAT   "%" INT64_MODIFIER "u"
 
#define PG_INT8_MIN   (-0x7F-1)
 
#define PG_INT8_MAX   (0x7F)
 
#define PG_UINT8_MAX   (0xFF)
 
#define PG_INT16_MIN   (-0x7FFF-1)
 
#define PG_INT16_MAX   (0x7FFF)
 
#define PG_UINT16_MAX   (0xFFFF)
 
#define PG_INT32_MIN   (-0x7FFFFFFF-1)
 
#define PG_INT32_MAX   (0x7FFFFFFF)
 
#define PG_UINT32_MAX   (0xFFFFFFFFU)
 
#define PG_INT64_MIN   (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
 
#define PG_INT64_MAX   INT64CONST(0x7FFFFFFFFFFFFFFF)
 
#define PG_UINT64_MAX   UINT64CONST(0xFFFFFFFFFFFFFFFF)
 
#define HAVE_INT64_TIMESTAMP
 
#define FLOAT8PASSBYVAL   false
 
#define InvalidSubTransactionId   ((SubTransactionId) 0)
 
#define TopSubTransactionId   ((SubTransactionId) 1)
 
#define FirstCommandId   ((CommandId) 0)
 
#define InvalidCommandId   (~(CommandId)0)
 
#define VARHDRSZ   ((int32) sizeof(int32))
 
#define NameStr(name)   ((name).data)
 
#define BoolIsValid(boolean)   ((boolean) == false || (boolean) == true)
 
#define PointerIsValid(pointer)   ((const void*)(pointer) != NULL)
 
#define PointerIsAligned(pointer, type)    (((uintptr_t)(pointer) % (sizeof (type))) == 0)
 
#define OffsetToPointer(base, offset)    ((void *)((char *) base + offset))
 
#define OidIsValid(objectId)   ((bool) ((objectId) != InvalidOid))
 
#define RegProcedureIsValid(p)   OidIsValid(p)
 
#define lengthof(array)   (sizeof (array) / sizeof ((array)[0]))
 
#define TYPEALIGN(ALIGNVAL, LEN)    (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1)))
 
#define SHORTALIGN(LEN)   TYPEALIGN(ALIGNOF_SHORT, (LEN))
 
#define INTALIGN(LEN)   TYPEALIGN(ALIGNOF_INT, (LEN))
 
#define LONGALIGN(LEN)   TYPEALIGN(ALIGNOF_LONG, (LEN))
 
#define DOUBLEALIGN(LEN)   TYPEALIGN(ALIGNOF_DOUBLE, (LEN))
 
#define MAXALIGN(LEN)   TYPEALIGN(MAXIMUM_ALIGNOF, (LEN))
 
#define BUFFERALIGN(LEN)   TYPEALIGN(ALIGNOF_BUFFER, (LEN))
 
#define CACHELINEALIGN(LEN)   TYPEALIGN(PG_CACHE_LINE_SIZE, (LEN))
 
#define TYPEALIGN_DOWN(ALIGNVAL, LEN)    (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1)))
 
#define SHORTALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))
 
#define INTALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))
 
#define LONGALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN))
 
#define DOUBLEALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN))
 
#define MAXALIGN_DOWN(LEN)   TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN))
 
#define BUFFERALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_BUFFER, (LEN))
 
#define TYPEALIGN64(ALIGNVAL, LEN)    (((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1)))
 
#define MAXALIGN64(LEN)   TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN))
 
#define Assert(condition)   ((void)true)
 
#define AssertMacro(condition)   ((void)true)
 
#define AssertPointerAlignment(ptr, bndr)    Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr))
 
#define StaticAssertDecl(condition, errmessage)    extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1])
 
#define StaticAssertStmt(condition, errmessage)    ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))
 
#define StaticAssertExpr(condition, errmessage)    StaticAssertStmt(condition, errmessage)
 
#define AssertVariableIsOfType(varname, typename)
 
#define AssertVariableIsOfTypeMacro(varname, typename)
 
#define Max(x, y)   ((x) > (y) ? (x) : (y))
 
#define Min(x, y)   ((x) < (y) ? (x) : (y))
 
#define LONG_ALIGN_MASK   (sizeof(long) - 1)
 
#define MemSet(start, val, len)
 
#define MemSetAligned(start, val, len)
 
#define MemSetTest(val, len)
 
#define MemSetLoop(start, val, len)
 
#define FLOAT4_FITS_IN_INT16(num)    ((num) >= (float4) PG_INT16_MIN && (num) < -((float4) PG_INT16_MIN))
 
#define FLOAT4_FITS_IN_INT32(num)    ((num) >= (float4) PG_INT32_MIN && (num) < -((float4) PG_INT32_MIN))
 
#define FLOAT4_FITS_IN_INT64(num)    ((num) >= (float4) PG_INT64_MIN && (num) < -((float4) PG_INT64_MIN))
 
#define FLOAT8_FITS_IN_INT16(num)    ((num) >= (float8) PG_INT16_MIN && (num) < -((float8) PG_INT16_MIN))
 
#define FLOAT8_FITS_IN_INT32(num)    ((num) >= (float8) PG_INT32_MIN && (num) < -((float8) PG_INT32_MIN))
 
#define FLOAT8_FITS_IN_INT64(num)    ((num) >= (float8) PG_INT64_MIN && (num) < -((float8) PG_INT64_MIN))
 
#define INVERT_COMPARE_RESULT(var)    ((var) = ((var) < 0) ? 1 : -(var))
 
#define HIGHBIT   (0x80)
 
#define IS_HIGHBIT_SET(ch)   ((unsigned char)(ch) & HIGHBIT)
 
#define SQL_STR_DOUBLE(ch, escape_backslash)    ((ch) == '\'' || ((ch) == '\\' && (escape_backslash)))
 
#define ESCAPE_STRING_SYNTAX   'E'
 
#define STATUS_OK   (0)
 
#define STATUS_ERROR   (-1)
 
#define STATUS_EOF   (-2)
 
#define gettext(x)   (x)
 
#define dgettext(d, x)   (x)
 
#define ngettext(s, p, n)   ((n) == 1 ? (s) : (p))
 
#define dngettext(d, s, p, n)   ((n) == 1 ? (s) : (p))
 
#define _(x)   gettext(x)
 
#define gettext_noop(x)   (x)
 
#define PG_TEXTDOMAIN(domain)   (domain "-" PG_MAJORVERSION)
 
#define unconstify(underlying_type, expr)    ((underlying_type) (expr))
 
#define unvolatize(underlying_type, expr)    ((underlying_type) (expr))
 
#define PG_BINARY   0
 
#define PG_BINARY_A   "a"
 
#define PG_BINARY_R   "r"
 
#define PG_BINARY_W   "w"
 
#define strtoi64(str, endptr, base)   ((int64) strtoll(str, endptr, base))
 
#define strtou64(str, endptr, base)   ((uint64) strtoull(str, endptr, base))
 
#define i64abs(i)   llabs(i)
 
#define PGDLLIMPORT
 
#define PGDLLEXPORT
 
#define SIGNAL_ARGS   int postgres_signal_arg
 

Typedefs

typedef void(* pg_funcptr_t) (void)
 
typedef unsigned char bool
 
typedef char * Pointer
 
typedef signed char int8
 
typedef signed short int16
 
typedef signed int int32
 
typedef unsigned char uint8
 
typedef unsigned short uint16
 
typedef unsigned int uint32
 
typedef uint8 bits8
 
typedef uint16 bits16
 
typedef uint32 bits32
 
typedef size_t Size
 
typedef unsigned int Index
 
typedef signed int Offset
 
typedef float float4
 
typedef double float8
 
typedef Oid regproc
 
typedef regproc RegProcedure
 
typedef uint32 TransactionId
 
typedef uint32 LocalTransactionId
 
typedef uint32 SubTransactionId
 
typedef TransactionId MultiXactId
 
typedef uint32 MultiXactOffset
 
typedef uint32 CommandId
 
typedef struct varlena bytea
 
typedef struct varlena text
 
typedef struct varlena BpChar
 
typedef struct varlena VarChar
 
typedef struct nameData NameData
 
typedef NameDataName
 
typedef union PGAlignedBlock PGAlignedBlock
 
typedef union PGIOAlignedBlock PGIOAlignedBlock
 
typedef union PGAlignedXLogBlock PGAlignedXLogBlock
 

Functions

void ExceptionalCondition (const char *conditionName, const char *fileName, int lineNumber) pg_attribute_noreturn()
 
int fdatasync (int fildes)
 

Macro Definition Documentation

◆ _

#define _ (   x)    gettext(x)

Definition at line 1198 of file c.h.

◆ __has_attribute

#define __has_attribute (   attribute)    0

Definition at line 118 of file c.h.

◆ Assert

#define Assert (   condition)    ((void)true)

Definition at line 847 of file c.h.

◆ AssertMacro

#define AssertMacro (   condition)    ((void)true)

Definition at line 848 of file c.h.

◆ AssertPointerAlignment

#define AssertPointerAlignment (   ptr,
  bndr 
)     Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr))

Definition at line 883 of file c.h.

◆ AssertVariableIsOfType

#define AssertVariableIsOfType (   varname,
  typename 
)
Value:
StaticAssertStmt(sizeof(varname) == sizeof(typename), \
CppAsString(varname) " does not have type " CppAsString(typename))
#define CppAsString(identifier)
Definition: c.h:315
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:927

Definition at line 970 of file c.h.

◆ AssertVariableIsOfTypeMacro

#define AssertVariableIsOfTypeMacro (   varname,
  typename 
)
Value:
(StaticAssertExpr(sizeof(varname) == sizeof(typename), \
CppAsString(varname) " does not have type " CppAsString(typename)))
#define StaticAssertExpr(condition, errmessage)
Definition: c.h:929

Definition at line 973 of file c.h.

◆ BoolIsValid

#define BoolIsValid (   boolean)    ((boolean) == false || (boolean) == true)

Definition at line 746 of file c.h.

◆ BUFFERALIGN

#define BUFFERALIGN (   LEN)    TYPEALIGN(ALIGNOF_BUFFER, (LEN))

Definition at line 802 of file c.h.

◆ BUFFERALIGN_DOWN

#define BUFFERALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(ALIGNOF_BUFFER, (LEN))

Definition at line 813 of file c.h.

◆ CACHELINEALIGN

#define CACHELINEALIGN (   LEN)    TYPEALIGN(PG_CACHE_LINE_SIZE, (LEN))

Definition at line 803 of file c.h.

◆ CppAsString

#define CppAsString (   identifier)    #identifier

Definition at line 315 of file c.h.

◆ CppAsString2

#define CppAsString2 (   x)    CppAsString(x)

Definition at line 316 of file c.h.

◆ CppConcat

#define CppConcat (   x,
  y 
)    x##y

Definition at line 317 of file c.h.

◆ dgettext

#define dgettext (   d,
  x 
)    (x)

Definition at line 1193 of file c.h.

◆ dngettext

#define dngettext (   d,
  s,
  p,
 
)    ((n) == 1 ? (s) : (p))

Definition at line 1195 of file c.h.

◆ DOUBLEALIGN

#define DOUBLEALIGN (   LEN)    TYPEALIGN(ALIGNOF_DOUBLE, (LEN))

Definition at line 799 of file c.h.

◆ DOUBLEALIGN_DOWN

#define DOUBLEALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN))

Definition at line 811 of file c.h.

◆ ESCAPE_STRING_SYNTAX

#define ESCAPE_STRING_SYNTAX   'E'

Definition at line 1179 of file c.h.

◆ false

return false   ((bool) 0)

Definition at line 453 of file c.h.

◆ FirstCommandId

#define FirstCommandId   ((CommandId) 0)

Definition at line 657 of file c.h.

◆ FLEXIBLE_ARRAY_MEMBER

#define FLEXIBLE_ARRAY_MEMBER   /* empty */

Definition at line 387 of file c.h.

◆ FLOAT4_FITS_IN_INT16

#define FLOAT4_FITS_IN_INT16 (   num)     ((num) >= (float4) PG_INT16_MIN && (num) < -((float4) PG_INT16_MIN))

Definition at line 1095 of file c.h.

◆ FLOAT4_FITS_IN_INT32

#define FLOAT4_FITS_IN_INT32 (   num)     ((num) >= (float4) PG_INT32_MIN && (num) < -((float4) PG_INT32_MIN))

Definition at line 1097 of file c.h.

◆ FLOAT4_FITS_IN_INT64

#define FLOAT4_FITS_IN_INT64 (   num)     ((num) >= (float4) PG_INT64_MIN && (num) < -((float4) PG_INT64_MIN))

Definition at line 1099 of file c.h.

◆ FLOAT8_FITS_IN_INT16

#define FLOAT8_FITS_IN_INT16 (   num)     ((num) >= (float8) PG_INT16_MIN && (num) < -((float8) PG_INT16_MIN))

Definition at line 1101 of file c.h.

◆ FLOAT8_FITS_IN_INT32

#define FLOAT8_FITS_IN_INT32 (   num)     ((num) >= (float8) PG_INT32_MIN && (num) < -((float8) PG_INT32_MIN))

Definition at line 1103 of file c.h.

◆ FLOAT8_FITS_IN_INT64

#define FLOAT8_FITS_IN_INT64 (   num)     ((num) >= (float8) PG_INT64_MIN && (num) < -((float8) PG_INT64_MIN))

Definition at line 1105 of file c.h.

◆ FLOAT8PASSBYVAL

#define FLOAT8PASSBYVAL   false

Definition at line 624 of file c.h.

◆ gettext

#define gettext (   x)    (x)

Definition at line 1192 of file c.h.

◆ gettext_noop

#define gettext_noop (   x)    (x)

Definition at line 1209 of file c.h.

◆ HAVE_INT64_TIMESTAMP

#define HAVE_INT64_TIMESTAMP

Definition at line 588 of file c.h.

◆ HIGHBIT

#define HIGHBIT   (0x80)

Definition at line 1167 of file c.h.

◆ i64abs

#define i64abs (   i)    llabs(i)

Definition at line 1317 of file c.h.

◆ INT64_FORMAT

#define INT64_FORMAT   "%" INT64_MODIFIER "d"

Definition at line 537 of file c.h.

◆ INTALIGN

#define INTALIGN (   LEN)    TYPEALIGN(ALIGNOF_INT, (LEN))

Definition at line 797 of file c.h.

◆ INTALIGN_DOWN

#define INTALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))

Definition at line 809 of file c.h.

◆ InvalidCommandId

#define InvalidCommandId   (~(CommandId)0)

Definition at line 658 of file c.h.

◆ InvalidSubTransactionId

#define InvalidSubTransactionId   ((SubTransactionId) 0)

Definition at line 647 of file c.h.

◆ INVERT_COMPARE_RESULT

#define INVERT_COMPARE_RESULT (   var)     ((var) = ((var) < 0) ? 1 : -(var))

Definition at line 1119 of file c.h.

◆ IS_HIGHBIT_SET

#define IS_HIGHBIT_SET (   ch)    ((unsigned char)(ch) & HIGHBIT)

Definition at line 1168 of file c.h.

◆ lengthof

#define lengthof (   array)    (sizeof (array) / sizeof ((array)[0]))

Definition at line 777 of file c.h.

◆ likely

#define likely (   x)    ((x) != 0)

Definition at line 299 of file c.h.

◆ LONG_ALIGN_MASK

#define LONG_ALIGN_MASK   (sizeof(long) - 1)

Definition at line 997 of file c.h.

◆ LONGALIGN

#define LONGALIGN (   LEN)    TYPEALIGN(ALIGNOF_LONG, (LEN))

Definition at line 798 of file c.h.

◆ LONGALIGN_DOWN

#define LONGALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN))

Definition at line 810 of file c.h.

◆ Max

#define Max (   x,
  y 
)    ((x) > (y) ? (x) : (y))

Definition at line 987 of file c.h.

◆ MAXALIGN

#define MAXALIGN (   LEN)    TYPEALIGN(MAXIMUM_ALIGNOF, (LEN))

Definition at line 800 of file c.h.

◆ MAXALIGN64

#define MAXALIGN64 (   LEN)    TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN))

Definition at line 825 of file c.h.

◆ MAXALIGN_DOWN

#define MAXALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN))

Definition at line 812 of file c.h.

◆ MemSet

#define MemSet (   start,
  val,
  len 
)
Value:
do \
{ \
/* must be void* because we don't know if it is integer aligned yet */ \
void *_vstart = (void *) (start); \
int _val = (val); \
Size _len = (len); \
if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
(_len & LONG_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT && \
/* \
* If MEMSET_LOOP_LIMIT == 0, optimizer should find \
* the whole "if" false at compile time. \
*/ \
MEMSET_LOOP_LIMIT != 0) \
{ \
long *_start = (long *) _vstart; \
long *_stop = (long *) ((char *) _start + _len); \
while (_start < _stop) \
*_start++ = 0; \
} \
else \
memset(_vstart, _val, _len); \
} while (0)
#define LONG_ALIGN_MASK
Definition: c.h:997
long val
Definition: informix.c:664
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77
const void size_t len

Definition at line 1009 of file c.h.

◆ MemSetAligned

#define MemSetAligned (   start,
  val,
  len 
)
Value:
do \
{ \
long *_start = (long *) (start); \
int _val = (val); \
Size _len = (len); \
if ((_len & LONG_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT && \
MEMSET_LOOP_LIMIT != 0) \
{ \
long *_stop = (long *) ((char *) _start + _len); \
while (_start < _stop) \
*_start++ = 0; \
} \
else \
memset(_start, _val, _len); \
} while (0)

Definition at line 1039 of file c.h.

◆ MemSetLoop

#define MemSetLoop (   start,
  val,
  len 
)
Value:
do \
{ \
long * _start = (long *) (start); \
long * _stop = (long *) ((char *) _start + (Size) (len)); \
while (_start < _stop) \
*_start++ = 0; \
} while (0)
size_t Size
Definition: c.h:594
while(p+4<=pend)

Definition at line 1074 of file c.h.

◆ MemSetTest

#define MemSetTest (   val,
  len 
)
Value:
( ((len) & LONG_ALIGN_MASK) == 0 && \
(len) <= MEMSET_LOOP_LIMIT && \
MEMSET_LOOP_LIMIT != 0 && \
(val) == 0 )

Definition at line 1068 of file c.h.

◆ Min

#define Min (   x,
  y 
)    ((x) < (y) ? (x) : (y))

Definition at line 993 of file c.h.

◆ NameStr

#define NameStr (   name)    ((name).data)

Definition at line 735 of file c.h.

◆ ngettext

#define ngettext (   s,
  p,
 
)    ((n) == 1 ? (s) : (p))

Definition at line 1194 of file c.h.

◆ OffsetToPointer

#define OffsetToPointer (   base,
  offset 
)     ((void *)((char *) base + offset))

Definition at line 761 of file c.h.

◆ OidIsValid

#define OidIsValid (   objectId)    ((bool) ((objectId) != InvalidOid))

Definition at line 764 of file c.h.

◆ pg_attribute_always_inline

#define pg_attribute_always_inline   inline

Definition at line 223 of file c.h.

◆ pg_attribute_cold

#define pg_attribute_cold

Definition at line 264 of file c.h.

◆ pg_attribute_format_arg

#define pg_attribute_format_arg (   a)

Definition at line 179 of file c.h.

◆ pg_attribute_hot

#define pg_attribute_hot

Definition at line 270 of file c.h.

◆ pg_attribute_no_sanitize_alignment

#define pg_attribute_no_sanitize_alignment ( )

Definition at line 149 of file c.h.

◆ pg_attribute_nonnull

#define pg_attribute_nonnull (   ...)

Definition at line 160 of file c.h.

◆ pg_attribute_noreturn

static void pg_attribute_noreturn ( )

Definition at line 206 of file c.h.

◆ pg_attribute_printf

#define pg_attribute_printf (   f,
  a 
)

Definition at line 180 of file c.h.

◆ pg_attribute_unused

#define pg_attribute_unused ( )

Definition at line 125 of file c.h.

◆ PG_BINARY

#define PG_BINARY   0

Definition at line 1283 of file c.h.

◆ PG_BINARY_A

#define PG_BINARY_A   "a"

Definition at line 1284 of file c.h.

◆ PG_BINARY_R

#define PG_BINARY_R   "r"

Definition at line 1285 of file c.h.

◆ PG_BINARY_W

#define PG_BINARY_W   "w"

Definition at line 1286 of file c.h.

◆ PG_INT16_MAX

#define PG_INT16_MAX   (0x7FFF)

Definition at line 575 of file c.h.

◆ PG_INT16_MIN

#define PG_INT16_MIN   (-0x7FFF-1)

Definition at line 574 of file c.h.

◆ PG_INT32_MAX

#define PG_INT32_MAX   (0x7FFFFFFF)

Definition at line 578 of file c.h.

◆ PG_INT32_MIN

#define PG_INT32_MIN   (-0x7FFFFFFF-1)

Definition at line 577 of file c.h.

◆ PG_INT64_MAX

#define PG_INT64_MAX   INT64CONST(0x7FFFFFFFFFFFFFFF)

Definition at line 581 of file c.h.

◆ PG_INT64_MIN

#define PG_INT64_MIN   (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)

Definition at line 580 of file c.h.

◆ PG_INT8_MAX

#define PG_INT8_MAX   (0x7F)

Definition at line 572 of file c.h.

◆ PG_INT8_MIN

#define PG_INT8_MIN   (-0x7F-1)

Definition at line 571 of file c.h.

◆ pg_nodiscard

#define pg_nodiscard

Definition at line 137 of file c.h.

◆ pg_noinline

#define pg_noinline

Definition at line 239 of file c.h.

◆ PG_TEXTDOMAIN

#define PG_TEXTDOMAIN (   domain)    (domain "-" PG_MAJORVERSION)

Definition at line 1227 of file c.h.

◆ PG_UINT16_MAX

#define PG_UINT16_MAX   (0xFFFF)

Definition at line 576 of file c.h.

◆ PG_UINT32_MAX

#define PG_UINT32_MAX   (0xFFFFFFFFU)

Definition at line 579 of file c.h.

◆ PG_UINT64_MAX

#define PG_UINT64_MAX   UINT64CONST(0xFFFFFFFFFFFFFFFF)

Definition at line 582 of file c.h.

◆ PG_UINT8_MAX

#define PG_UINT8_MAX   (0xFF)

Definition at line 573 of file c.h.

◆ pg_unreachable

#define pg_unreachable ( )    abort()

Definition at line 285 of file c.h.

◆ PG_USED_FOR_ASSERTS_ONLY

#define PG_USED_FOR_ASSERTS_ONLY   pg_attribute_unused()

Definition at line 171 of file c.h.

◆ PGDLLEXPORT

#define PGDLLEXPORT

Definition at line 1341 of file c.h.

◆ PGDLLIMPORT

#define PGDLLIMPORT

Definition at line 1326 of file c.h.

◆ PointerIsAligned

#define PointerIsAligned (   pointer,
  type 
)     (((uintptr_t)(pointer) % (sizeof (type))) == 0)

Definition at line 758 of file c.h.

◆ PointerIsValid

#define PointerIsValid (   pointer)    ((const void*)(pointer) != NULL)

Definition at line 752 of file c.h.

◆ RegProcedureIsValid

#define RegProcedureIsValid (   p)    OidIsValid(p)

Definition at line 766 of file c.h.

◆ SHORTALIGN

#define SHORTALIGN (   LEN)    TYPEALIGN(ALIGNOF_SHORT, (LEN))

Definition at line 796 of file c.h.

◆ SHORTALIGN_DOWN

#define SHORTALIGN_DOWN (   LEN)    TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))

Definition at line 808 of file c.h.

◆ SIGNAL_ARGS

#define SIGNAL_ARGS   int postgres_signal_arg

Definition at line 1355 of file c.h.

◆ SQL_STR_DOUBLE

#define SQL_STR_DOUBLE (   ch,
  escape_backslash 
)     ((ch) == '\'' || ((ch) == '\\' && (escape_backslash)))

Definition at line 1176 of file c.h.

◆ StaticAssertDecl

#define StaticAssertDecl (   condition,
  errmessage 
)     extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1])

Definition at line 925 of file c.h.

◆ StaticAssertExpr

#define StaticAssertExpr (   condition,
  errmessage 
)     StaticAssertStmt(condition, errmessage)

Definition at line 929 of file c.h.

◆ StaticAssertStmt

#define StaticAssertStmt (   condition,
  errmessage 
)     ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))

Definition at line 927 of file c.h.

◆ STATUS_EOF

#define STATUS_EOF   (-2)

Definition at line 1184 of file c.h.

◆ STATUS_ERROR

#define STATUS_ERROR   (-1)

Definition at line 1183 of file c.h.

◆ STATUS_OK

#define STATUS_OK   (0)

Definition at line 1182 of file c.h.

◆ strtoi64

#define strtoi64 (   str,
  endptr,
  base 
)    ((int64) strtoll(str, endptr, base))

Definition at line 1307 of file c.h.

◆ strtou64

#define strtou64 (   str,
  endptr,
  base 
)    ((uint64) strtoull(str, endptr, base))

Definition at line 1308 of file c.h.

◆ TopSubTransactionId

#define TopSubTransactionId   ((SubTransactionId) 1)

Definition at line 648 of file c.h.

◆ true

#define true   ((bool) 1)

Definition at line 449 of file c.h.

◆ TYPEALIGN

#define TYPEALIGN (   ALIGNVAL,
  LEN 
)     (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1)))

Definition at line 793 of file c.h.

◆ TYPEALIGN64

#define TYPEALIGN64 (   ALIGNVAL,
  LEN 
)     (((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1)))

Definition at line 821 of file c.h.

◆ TYPEALIGN_DOWN

#define TYPEALIGN_DOWN (   ALIGNVAL,
  LEN 
)     (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1)))

Definition at line 805 of file c.h.

◆ UINT64_FORMAT

#define UINT64_FORMAT   "%" INT64_MODIFIER "u"

Definition at line 538 of file c.h.

◆ unconstify

#define unconstify (   underlying_type,
  expr 
)     ((underlying_type) (expr))

Definition at line 1255 of file c.h.

◆ unlikely

#define unlikely (   x)    ((x) != 0)

Definition at line 300 of file c.h.

◆ unvolatize

#define unvolatize (   underlying_type,
  expr 
)     ((underlying_type) (expr))

Definition at line 1257 of file c.h.

◆ VA_ARGS_NARGS

#define VA_ARGS_NARGS (   ...)
Value:
VA_ARGS_NARGS_(__VA_ARGS__, \
63,62,61,60, \
59,58,57,56,55,54,53,52,51,50, \
49,48,47,46,45,44,43,42,41,40, \
39,38,37,36,35,34,33,32,31,30, \
29,28,27,26,25,24,23,22,21,20, \
19,18,17,16,15,14,13,12,11,10, \
9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define VA_ARGS_NARGS_(_01, _02, _03, _04, _05, _06, _07, _08, _09, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N,...)
Definition: c.h:362

Definition at line 351 of file c.h.

◆ VA_ARGS_NARGS_

#define VA_ARGS_NARGS_ (   _01,
  _02,
  _03,
  _04,
  _05,
  _06,
  _07,
  _08,
  _09,
  _10,
  _11,
  _12,
  _13,
  _14,
  _15,
  _16,
  _17,
  _18,
  _19,
  _20,
  _21,
  _22,
  _23,
  _24,
  _25,
  _26,
  _27,
  _28,
  _29,
  _30,
  _31,
  _32,
  _33,
  _34,
  _35,
  _36,
  _37,
  _38,
  _39,
  _40,
  _41,
  _42,
  _43,
  _44,
  _45,
  _46,
  _47,
  _48,
  _49,
  _50,
  _51,
  _52,
  _53,
  _54,
  _55,
  _56,
  _57,
  _58,
  _59,
  _60,
  _61,
  _62,
  _63,
  N,
  ... 
)     (N)

Definition at line 362 of file c.h.

◆ VARHDRSZ

#define VARHDRSZ   ((int32) sizeof(int32))

Definition at line 681 of file c.h.

Typedef Documentation

◆ bits16

typedef uint16 bits16

Definition at line 503 of file c.h.

◆ bits32

typedef uint32 bits32

Definition at line 504 of file c.h.

◆ bits8

typedef uint8 bits8

Definition at line 502 of file c.h.

◆ bool

typedef unsigned char bool

Definition at line 445 of file c.h.

◆ BpChar

typedef struct varlena BpChar

Definition at line 655 of file c.h.

◆ bytea

typedef struct varlena bytea

Definition at line 655 of file c.h.

◆ CommandId

typedef uint32 CommandId

Definition at line 655 of file c.h.

◆ float4

typedef float float4

Definition at line 618 of file c.h.

◆ float8

typedef double float8

Definition at line 619 of file c.h.

◆ Index

typedef unsigned int Index

Definition at line 603 of file c.h.

◆ int16

typedef signed short int16

Definition at line 482 of file c.h.

◆ int32

typedef signed int int32

Definition at line 483 of file c.h.

◆ int8

typedef signed char int8

Definition at line 481 of file c.h.

◆ LocalTransactionId

Definition at line 643 of file c.h.

◆ MultiXactId

Definition at line 651 of file c.h.

◆ MultiXactOffset

Definition at line 653 of file c.h.

◆ Name

typedef NameData* Name

Definition at line 733 of file c.h.

◆ NameData

typedef struct nameData NameData

◆ Offset

typedef signed int Offset

Definition at line 613 of file c.h.

◆ pg_funcptr_t

typedef void(* pg_funcptr_t) (void)

Definition at line 377 of file c.h.

◆ PGAlignedBlock

◆ PGAlignedXLogBlock

◆ PGIOAlignedBlock

◆ Pointer

typedef char* Pointer

Definition at line 472 of file c.h.

◆ regproc

typedef Oid regproc

Definition at line 638 of file c.h.

◆ RegProcedure

Definition at line 639 of file c.h.

◆ Size

typedef size_t Size

Definition at line 594 of file c.h.

◆ SubTransactionId

Definition at line 645 of file c.h.

◆ text

typedef struct varlena text

Definition at line 655 of file c.h.

◆ TransactionId

Definition at line 641 of file c.h.

◆ uint16

typedef unsigned short uint16

Definition at line 494 of file c.h.

◆ uint32

typedef unsigned int uint32

Definition at line 495 of file c.h.

◆ uint8

typedef unsigned char uint8

Definition at line 493 of file c.h.

◆ VarChar

typedef struct varlena VarChar

Definition at line 655 of file c.h.

Function Documentation

◆ ExceptionalCondition()

void ExceptionalCondition ( const char *  conditionName,
const char *  fileName,
int  lineNumber 
)

Definition at line 30 of file assert.c.

33 {
34  /* Report the failure on stderr (or local equivalent) */
35  if (!PointerIsValid(conditionName)
36  || !PointerIsValid(fileName))
37  write_stderr("TRAP: ExceptionalCondition: bad arguments in PID %d\n",
38  (int) getpid());
39  else
40  write_stderr("TRAP: failed Assert(\"%s\"), File: \"%s\", Line: %d, PID: %d\n",
41  conditionName, fileName, lineNumber, (int) getpid());
42 
43  /* Usually this shouldn't be needed, but make sure the msg went out */
44  fflush(stderr);
45 
46  /* If we have support for it, dump a simple backtrace */
47 #ifdef HAVE_BACKTRACE_SYMBOLS
48  {
49  void *buf[100];
50  int nframes;
51 
52  nframes = backtrace(buf, lengthof(buf));
53  backtrace_symbols_fd(buf, nframes, fileno(stderr));
54  }
55 #endif
56 
57  /*
58  * If configured to do so, sleep indefinitely to allow user to attach a
59  * debugger. It would be nice to use pg_usleep() here, but that can sleep
60  * at most 2G usec or ~33 minutes, which seems too short.
61  */
62 #ifdef SLEEP_ON_ASSERT
63  sleep(1000000);
64 #endif
65 
66  abort();
67 }
#define write_stderr(str)
Definition: parallel.c:184
#define PointerIsValid(pointer)
Definition: c.h:752
#define lengthof(array)
Definition: c.h:777
static void const char fflush(stdout)
static char * buf
Definition: pg_test_fsync.c:67

References buf, fflush(), lengthof, PointerIsValid, and write_stderr.

Referenced by pg_re_throw().

◆ fdatasync()

int fdatasync ( int  fildes)

Definition at line 23 of file win32fdatasync.c.

24 {
25  IO_STATUS_BLOCK iosb;
26  NTSTATUS status;
27  HANDLE handle;
28 
29  handle = (HANDLE) _get_osfhandle(fd);
30  if (handle == INVALID_HANDLE_VALUE)
31  {
32  errno = EBADF;
33  return -1;
34  }
35 
36  if (initialize_ntdll() < 0)
37  return -1;
38 
39  memset(&iosb, 0, sizeof(iosb));
40  status = pg_NtFlushBuffersFileEx(handle,
42  NULL,
43  0,
44  &iosb);
45 
46  if (NT_SUCCESS(status))
47  return 0;
48 
50  return -1;
51 }
static int fd(const char *x, int i)
Definition: preproc-init.c:105
void _dosmaperr(unsigned long)
Definition: win32error.c:177
PGDLLIMPORT NtFlushBuffersFileEx_t pg_NtFlushBuffersFileEx
Definition: win32ntdll.c:22
int initialize_ntdll(void)
Definition: win32ntdll.c:39
#define FLUSH_FLAGS_FILE_DATA_SYNC_ONLY
Definition: win32ntdll.h:21
PGDLLIMPORT RtlNtStatusToDosError_t pg_RtlNtStatusToDosError
Definition: win32ntdll.c:21

References _dosmaperr(), fd(), FLUSH_FLAGS_FILE_DATA_SYNC_ONLY, initialize_ntdll(), pg_NtFlushBuffersFileEx, and pg_RtlNtStatusToDosError.

Referenced by pg_fdatasync(), and test_sync().