Skip to content

Instantly share code, notes, and snippets.

@trasz
Created April 5, 2017 15:41
Show Gist options
  • Save trasz/a7958c5c66fc9643dbe24d448959a0d2 to your computer and use it in GitHub Desktop.
Save trasz/a7958c5c66fc9643dbe24d448959a0d2 to your computer and use it in GitHub Desktop.
# 1 "<built-in>"
# 1 "spgdoinsert.c"
/*-------------------------------------------------------------------------
*
* spgdoinsert.c
* implementation of insert algorithm
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/backend/access/spgist/spgdoinsert.c
*
*-------------------------------------------------------------------------
*/
#if 0 /* expanded by -frewrite-includes */
#include "postgres.h"
#endif /* expanded by -frewrite-includes */
# 16 "spgdoinsert.c"
# 1 "../../../../src/include/postgres.h" 1
/*-------------------------------------------------------------------------
*
* postgres.h
* Primary include file for PostgreSQL server .c files
*
* This should be the first file included by PostgreSQL backend modules.
* Client-side code should include postgres_fe.h instead.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California
*
* src/include/postgres.h
*
*-------------------------------------------------------------------------
*/
/*
*----------------------------------------------------------------
* TABLE OF CONTENTS
*
* When adding stuff to this file, please try to put stuff
* into the relevant section, or add new sections as appropriate.
*
* section description
* ------- ------------------------------------------------
* 1) variable-length datatypes (TOAST support)
* 2) datum type + support macros
* 3) exception handling backend support
*
* NOTES
*
* In general, this file should contain declarations that are widely needed
* in the backend environment, but are of no interest outside the backend.
*
* Simple type definitions live in c.h, where they are shared with
* postgres_fe.h. We do that since those type definitions are needed by
* frontend modules that want to deal with binary data transmission to or
* from the backend. Type definitions in this file should be for
* representations that never escape the backend, such as Datum or
* TOASTed varlena objects.
*
*----------------------------------------------------------------
*/
#ifndef POSTGRES_H
#define POSTGRES_H
#if 0 /* expanded by -frewrite-includes */
#include "c.h"
#endif /* expanded by -frewrite-includes */
# 47 "../../../../src/include/postgres.h"
# 1 "../../../../src/include/c.h" 1
/*-------------------------------------------------------------------------
*
* c.h
* Fundamental C definitions. This is included by every .c file in
* PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate).
*
* Note that the definitions here are not intended to be exposed to clients
* of the frontend interface libraries --- so we don't worry much about
* polluting the namespace with lots of stuff...
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/c.h
*
*-------------------------------------------------------------------------
*/
/*
*----------------------------------------------------------------
* TABLE OF CONTENTS
*
* When adding stuff to this file, please try to put stuff
* into the relevant section, or add new sections as appropriate.
*
* section description
* ------- ------------------------------------------------
* 0) pg_config.h and standard system headers
* 1) hacks to cope with non-ANSI C compilers
* 2) bool, true, false, TRUE, FALSE, NULL
* 3) standard system types
* 4) IsValid macros for system types
* 5) offsetof, lengthof, endof, alignment
* 6) assertions
* 7) widely useful macros
* 8) random stuff
* 9) system-specific hacks
*
* NOTE: since this file is included by both frontend and backend modules, it's
* almost certainly wrong to put an "extern" declaration here. typedefs and
* macros are the kind of thing that might go here.
*
*----------------------------------------------------------------
*/
#ifndef C_H
#define C_H
#if 0 /* expanded by -frewrite-includes */
#include "postgres_ext.h"
#endif /* expanded by -frewrite-includes */
# 48 "../../../../src/include/c.h"
# 1 "../../../../src/include/postgres_ext.h" 1
/*-------------------------------------------------------------------------
*
* postgres_ext.h
*
* This file contains declarations of things that are visible everywhere
* in PostgreSQL *and* are visible to clients of frontend interface libraries.
* For example, the Oid type is part of the API of libpq and other libraries.
*
* Declarations which are specific to a particular interface should
* go in the header file for that interface (such as libpq-fe.h). This
* file is only for fundamental Postgres declarations.
*
* User-written C functions don't count as "external to Postgres."
* Those function much as local modifications to the backend itself, and
* use header files that are otherwise internal to Postgres to interface
* with the backend.
*
* src/include/postgres_ext.h
*
*-------------------------------------------------------------------------
*/
#ifndef POSTGRES_EXT_H
#define POSTGRES_EXT_H
#if 0 /* expanded by -frewrite-includes */
#include "pg_config_ext.h"
#endif /* expanded by -frewrite-includes */
# 26 "../../../../src/include/postgres_ext.h"
# 1 "../../../../src/include/pg_config_ext.h" 1
/* src/include/pg_config_ext.h. Generated from pg_config_ext.h.in by configure. */
/*
* src/include/pg_config_ext.h.in. This is generated manually, not by
* autoheader, since we want to limit which symbols get defined here.
*/
/* Define to the name of a signed 64-bit integer type. */
#define PG_INT64_TYPE long int
# 27 "../../../../src/include/postgres_ext.h" 2
/*
* Object ID is a fundamental type in Postgres.
*/
typedef unsigned int Oid;
#ifdef __cplusplus
#define InvalidOid (Oid(0))
#else
# 36 "../../../../src/include/postgres_ext.h"
#define InvalidOid ((Oid) 0)
#endif
# 38 "../../../../src/include/postgres_ext.h"
#define OID_MAX UINT_MAX
/* you will need to include <limits.h> to use the above #define */
/* Define a signed 64-bit integer type for use in client API declarations. */
typedef PG_INT64_TYPE pg_int64;
/*
* Identifiers of error message fields. Kept here to keep common
* between frontend and backend, and also to export them to libpq
* applications.
*/
#define PG_DIAG_SEVERITY 'S'
#define PG_DIAG_SEVERITY_NONLOCALIZED 'V'
#define PG_DIAG_SQLSTATE 'C'
#define PG_DIAG_MESSAGE_PRIMARY 'M'
#define PG_DIAG_MESSAGE_DETAIL 'D'
#define PG_DIAG_MESSAGE_HINT 'H'
#define PG_DIAG_STATEMENT_POSITION 'P'
#define PG_DIAG_INTERNAL_POSITION 'p'
#define PG_DIAG_INTERNAL_QUERY 'q'
#define PG_DIAG_CONTEXT 'W'
#define PG_DIAG_SCHEMA_NAME 's'
#define PG_DIAG_TABLE_NAME 't'
#define PG_DIAG_COLUMN_NAME 'c'
#define PG_DIAG_DATATYPE_NAME 'd'
#define PG_DIAG_CONSTRAINT_NAME 'n'
#define PG_DIAG_SOURCE_FILE 'F'
#define PG_DIAG_SOURCE_LINE 'L'
#define PG_DIAG_SOURCE_FUNCTION 'R'
#endif /* POSTGRES_EXT_H */
# 71 "../../../../src/include/postgres_ext.h"
# 49 "../../../../src/include/c.h" 2
/* Must undef pg_config_ext.h symbols before including pg_config.h */
#undef PG_INT64_TYPE
#if 0 /* expanded by -frewrite-includes */
#include "pg_config.h"
#endif /* expanded by -frewrite-includes */
# 53 "../../../../src/include/c.h"
# 1 "../../../../src/include/pg_config.h" 1
/* src/include/pg_config.h. Generated from pg_config.h.in by configure. */
/* src/include/pg_config.h.in. Generated from configure.in by autoheader. */
/* Define to the type of arg 1 of 'accept' */
#define ACCEPT_TYPE_ARG1 int
/* Define to the type of arg 2 of 'accept' */
#define ACCEPT_TYPE_ARG2 struct sockaddr *
/* Define to the type of arg 3 of 'accept' */
#define ACCEPT_TYPE_ARG3 socklen_t
/* Define to the return type of 'accept' */
#define ACCEPT_TYPE_RETURN int
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* The normal alignment of `double', in bytes. */
#define ALIGNOF_DOUBLE 8
/* The normal alignment of `int', in bytes. */
#define ALIGNOF_INT 4
/* The normal alignment of `long', in bytes. */
#define ALIGNOF_LONG 8
/* The normal alignment of `long long int', in bytes. */
/* #undef ALIGNOF_LONG_LONG_INT */
/* The normal alignment of `short', in bytes. */
#define ALIGNOF_SHORT 2
/* The normal alignment of `void*', in bytes. */
#define ALIGNOF_VOIDP 32
/* Size of a disk block --- this also limits the size of a tuple. You can set
it bigger if you need bigger tuples (although TOAST should reduce the need
to have large tuples, since fields can be spread across multiple tuples).
BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is
currently 2^15 (32768). This is determined by the 15-bit widths of the
lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
Changing BLCKSZ requires an initdb. */
#define BLCKSZ 8192
/* Define to the default TCP port number on which the server listens and to
which clients will try to connect. This can be overridden at run-time, but
it's convenient if your clients have the right default compiled in.
(--with-pgport=PORTNUM) */
#define DEF_PGPORT 5432
/* Define to the default TCP port number as a string constant. */
#define DEF_PGPORT_STR "5432"
/* Define to build with GSSAPI support. (--with-gssapi) */
/* #undef ENABLE_GSS */
/* Define to 1 if you want National Language Support. (--enable-nls) */
/* #undef ENABLE_NLS */
/* Define to 1 to build client libraries as thread-safe code.
(--enable-thread-safety) */
#define ENABLE_THREAD_SAFETY 1
/* Define to nothing if C supports flexible array members, and to 1 if it does
not. That way, with a declaration like `struct s { int n; double
d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
compilers. When computing the size of such an object, don't use 'sizeof
(struct s)' as it overestimates the size. Use 'offsetof (struct s, d)'
instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with
MSVC and with C++ compilers. */
#define FLEXIBLE_ARRAY_MEMBER /**/
/* float4 values are passed by value if 'true', by reference if 'false' */
#define FLOAT4PASSBYVAL true
/* float8, int8, and related values are passed by value if 'true', by
reference if 'false' */
#define FLOAT8PASSBYVAL true
/* Define to 1 if gettimeofday() takes only 1 argument. */
/* #undef GETTIMEOFDAY_1ARG */
#ifdef GETTIMEOFDAY_1ARG
# define gettimeofday(a,b) gettimeofday(a)
#endif
# 87 "../../../../src/include/pg_config.h"
/* Define to 1 if you have the `append_history' function. */
/* #undef HAVE_APPEND_HISTORY */
/* Define to 1 if you have the `ASN1_STRING_get0_data' function. */
/* #undef HAVE_ASN1_STRING_GET0_DATA */
/* Define to 1 if you want to use atomics if available. */
#define HAVE_ATOMICS 1
/* Define to 1 if you have the <atomic.h> header file. */
/* #undef HAVE_ATOMIC_H */
/* Define to 1 if you have the `BIO_get_data' function. */
/* #undef HAVE_BIO_GET_DATA */
/* Define to 1 if you have the `BIO_meth_new' function. */
/* #undef HAVE_BIO_METH_NEW */
/* Define to 1 if you have the `cbrt' function. */
#define HAVE_CBRT 1
/* Define to 1 if you have the `class' function. */
/* #undef HAVE_CLASS */
/* Define to 1 if you have the <crtdefs.h> header file. */
/* #undef HAVE_CRTDEFS_H */
/* Define to 1 if you have the `crypt' function. */
#define HAVE_CRYPT 1
/* Define to 1 if you have the `CRYPTO_lock' function. */
/* #undef HAVE_CRYPTO_LOCK */
/* Define to 1 if you have the <crypt.h> header file. */
/* #undef HAVE_CRYPT_H */
/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
don't. */
#define HAVE_DECL_FDATASYNC 1
/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
don't. */
#define HAVE_DECL_F_FULLFSYNC 0
/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you
don't. */
#define HAVE_DECL_POSIX_FADVISE 1
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#define HAVE_DECL_SNPRINTF 1
/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
don't. */
#define HAVE_DECL_STRLCAT 1
/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
don't. */
#define HAVE_DECL_STRLCPY 1
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#define HAVE_DECL_SYS_SIGLIST 1
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
don't. */
#define HAVE_DECL_VSNPRINTF 1
/* Define to 1 if you have the <dld.h> header file. */
/* #undef HAVE_DLD_H */
/* Define to 1 if you have the `dlopen' function. */
#define HAVE_DLOPEN 1
/* Define to 1 if you have the <editline/history.h> header file. */
/* #undef HAVE_EDITLINE_HISTORY_H */
/* Define to 1 if you have the <editline/readline.h> header file. */
/* #undef HAVE_EDITLINE_READLINE_H */
/* Define to 1 if you have the `fdatasync' function. */
#define HAVE_FDATASYNC 1
/* Define to 1 if you have the `fls' function. */
#define HAVE_FLS 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef HAVE_FPCLASS */
/* Define to 1 if you have the `fp_class' function. */
/* #undef HAVE_FP_CLASS */
/* Define to 1 if you have the `fp_class_d' function. */
/* #undef HAVE_FP_CLASS_D */
/* Define to 1 if you have the <fp_class.h> header file. */
/* #undef HAVE_FP_CLASS_H */
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#define HAVE_FSEEKO 1
/* Define to 1 if your compiler understands __func__. */
#define HAVE_FUNCNAME__FUNC 1
/* Define to 1 if your compiler understands __FUNCTION__. */
/* #undef HAVE_FUNCNAME__FUNCTION */
/* Define to 1 if you have __atomic_compare_exchange_n(int *, int *, int). */
#define HAVE_GCC__ATOMIC_INT32_CAS 1
/* Define to 1 if you have __atomic_compare_exchange_n(int64 *, int *, int64).
*/
#define HAVE_GCC__ATOMIC_INT64_CAS 1
/* Define to 1 if you have __sync_lock_test_and_set(char *) and friends. */
#define HAVE_GCC__SYNC_CHAR_TAS 1
/* Define to 1 if you have __sync_compare_and_swap(int *, int, int). */
#define HAVE_GCC__SYNC_INT32_CAS 1
/* Define to 1 if you have __sync_lock_test_and_set(int *) and friends. */
#define HAVE_GCC__SYNC_INT32_TAS 1
/* Define to 1 if you have __sync_compare_and_swap(int64 *, int64, int64). */
#define HAVE_GCC__SYNC_INT64_CAS 1
/* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `gethostbyname_r' function. */
#define HAVE_GETHOSTBYNAME_R 1
/* Define to 1 if you have the `getifaddrs' function. */
#define HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1
/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define to 1 if you have the `getopt_long' function. */
#define HAVE_GETOPT_LONG 1
/* Define to 1 if you have the `getpeereid' function. */
#define HAVE_GETPEEREID 1
/* Define to 1 if you have the `getpeerucred' function. */
/* #undef HAVE_GETPEERUCRED */
/* Define to 1 if you have the `getpwuid_r' function. */
#define HAVE_GETPWUID_R 1
/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1
/* Define to 1 if you have the `getrusage' function. */
#define HAVE_GETRUSAGE 1
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_H */
/* Define to 1 if you have the <gssapi.h> header file. */
/* #undef HAVE_GSSAPI_H */
/* Define to 1 if you have the <history.h> header file. */
/* #undef HAVE_HISTORY_H */
/* Define to 1 if you have the `history_truncate_file' function. */
/* #undef HAVE_HISTORY_TRUNCATE_FILE */
/* Define to 1 if you have the <ieeefp.h> header file. */
#define HAVE_IEEEFP_H 1
/* Define to 1 if you have the <ifaddrs.h> header file. */
#define HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define to 1 if the system has the type `int64'. */
/* #undef HAVE_INT64 */
/* Define to 1 if the system has the type `int8'. */
/* #undef HAVE_INT8 */
/* Define to 1 if the system has the type `intptr_t'. */
#define HAVE_INTPTR_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the global variable 'int opterr'. */
#define HAVE_INT_OPTERR 1
/* Define to 1 if you have the global variable 'int optreset'. */
#define HAVE_INT_OPTRESET 1
/* Define to 1 if you have the global variable 'int timezone'. */
/* #undef HAVE_INT_TIMEZONE */
/* Define to 1 if you have support for IPv6. */
#define HAVE_IPV6 1
/* Define to 1 if you have isinf(). */
#define HAVE_ISINF 1
/* Define to 1 if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1
/* Define to 1 if you have the <ldap.h> header file. */
/* #undef HAVE_LDAP_H */
/* Define to 1 if you have the `crypto' library (-lcrypto). */
/* #undef HAVE_LIBCRYPTO */
/* Define to 1 if you have the `ldap' library (-lldap). */
/* #undef HAVE_LIBLDAP */
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
/* #undef HAVE_LIBLDAP_R */
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `pam' library (-lpam). */
/* #undef HAVE_LIBPAM */
/* Define if you have a function readline library */
/* #undef HAVE_LIBREADLINE */
/* Define to 1 if you have the `selinux' library (-lselinux). */
/* #undef HAVE_LIBSELINUX */
/* Define to 1 if you have the `ssl' library (-lssl). */
/* #undef HAVE_LIBSSL */
/* Define to 1 if you have the `wldap32' library (-lwldap32). */
/* #undef HAVE_LIBWLDAP32 */
/* Define to 1 if you have the `xml2' library (-lxml2). */
/* #undef HAVE_LIBXML2 */
/* Define to 1 if you have the `xslt' library (-lxslt). */
/* #undef HAVE_LIBXSLT */
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if constants of type 'long long int' should have the suffix LL.
*/
/* #undef HAVE_LL_CONSTANTS */
/* Define to 1 if the system has the type `locale_t'. */
#define HAVE_LOCALE_T 1
/* Define to 1 if `long int' works and is 64 bits. */
#define HAVE_LONG_INT_64 1
/* Define to 1 if the system has the type `long long int'. */
#define HAVE_LONG_LONG_INT 1
/* Define to 1 if `long long int' works and is 64 bits. */
/* #undef HAVE_LONG_LONG_INT_64 */
/* Define to 1 if you have the <mbarrier.h> header file. */
/* #undef HAVE_MBARRIER_H */
/* Define to 1 if you have the `mbstowcs_l' function. */
#define HAVE_MBSTOWCS_L 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
/* #undef HAVE_MINIDUMP_TYPE */
/* Define to 1 if you have the `mkdtemp' function. */
#define HAVE_MKDTEMP 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define HAVE_NETINET_TCP_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the `OPENSSL_init_ssl' function. */
/* #undef HAVE_OPENSSL_INIT_SSL */
/* Define to 1 if you have the <ossp/uuid.h> header file. */
/* #undef HAVE_OSSP_UUID_H */
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
/* #undef HAVE_PAM_PAM_APPL_H */
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `posix_fadvise' function. */
#define HAVE_POSIX_FADVISE 1
/* Define to 1 if the assembler supports PPC's LWARX mutex hint bit. */
/* #undef HAVE_PPC_LWARX_MUTEX_HINT */
/* Define to 1 if you have the `pstat' function. */
/* #undef HAVE_PSTAT */
/* Define to 1 if the PS_STRINGS thing exists. */
/* #undef HAVE_PS_STRINGS */
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
/* Define to 1 if you have the `pthread_is_threaded_np' function. */
/* #undef HAVE_PTHREAD_IS_THREADED_NP */
/* Have PTHREAD_PRIO_INHERIT. */
#define HAVE_PTHREAD_PRIO_INHERIT 1
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define to 1 if you have the `random' function. */
#define HAVE_RANDOM 1
/* Define to 1 if you have the `RAND_OpenSSL' function. */
/* #undef HAVE_RAND_OPENSSL */
/* Define to 1 if you have the <readline.h> header file. */
/* #undef HAVE_READLINE_H */
/* Define to 1 if you have the <readline/history.h> header file. */
/* #undef HAVE_READLINE_HISTORY_H */
/* Define to 1 if you have the <readline/readline.h> header file. */
/* #undef HAVE_READLINE_READLINE_H */
/* Define to 1 if you have the `readlink' function. */
#define HAVE_READLINK 1
/* Define to 1 if you have the `rint' function. */
#define HAVE_RINT 1
/* Define to 1 if you have the global variable
'rl_completion_append_character'. */
/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
/* Define to 1 if you have the `rl_completion_matches' function. */
/* #undef HAVE_RL_COMPLETION_MATCHES */
/* Define to 1 if you have the `rl_filename_completion_function' function. */
/* #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION */
/* Define to 1 if you have the `rl_reset_screen_size' function. */
/* #undef HAVE_RL_RESET_SCREEN_SIZE */
/* Define to 1 if you have the <security/pam_appl.h> header file. */
/* #undef HAVE_SECURITY_PAM_APPL_H */
/* Define to 1 if you have the `setproctitle' function. */
#define HAVE_SETPROCTITLE 1
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
/* Define to 1 if you have the `shm_open' function. */
#define HAVE_SHM_OPEN 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have spinlocks. */
#define HAVE_SPINLOCKS 1
/* Define to 1 if you have the `srandom' function. */
#define HAVE_SRANDOM 1
/* Define to 1 if you have the `SSL_get_current_compression' function. */
/* #undef HAVE_SSL_GET_CURRENT_COMPRESSION */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcat' function. */
#define HAVE_STRLCAT 1
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* Define to 1 if you have the `strtoq' function. */
/* #undef HAVE_STRTOQ */
/* Define to 1 if you have the `strtoull' function. */
#define HAVE_STRTOULL 1
/* Define to 1 if you have the `strtouq' function. */
/* #undef HAVE_STRTOUQ */
/* Define to 1 if the system has the type `struct addrinfo'. */
#define HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct cmsgcred'. */
#define HAVE_STRUCT_CMSGCRED 1
/* Define to 1 if the system has the type `struct option'. */
#define HAVE_STRUCT_OPTION 1
/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
/* Define to 1 if `ss_len' is a member of `struct sockaddr_storage'. */
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
/* Define to 1 if `__ss_len' is a member of `struct sockaddr_storage'. */
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#define HAVE_STRUCT_TM_TM_ZONE 1
/* Define to 1 if you have the `symlink' function. */
#define HAVE_SYMLINK 1
/* Define to 1 if you have the `sync_file_range' function. */
/* #undef HAVE_SYNC_FILE_RANGE */
/* Define to 1 if you have the syslog interface. */
#define HAVE_SYSLOG 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
/* #undef HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/pstat.h> header file. */
/* #undef HAVE_SYS_PSTAT_H */
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
#define HAVE_SYS_SEM_H 1
/* Define to 1 if you have the <sys/shm.h> header file. */
#define HAVE_SYS_SHM_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
#define HAVE_SYS_SOCKIO_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/tas.h> header file. */
/* #undef HAVE_SYS_TAS_H */
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucred.h> header file. */
#define HAVE_SYS_UCRED_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead. */
#define HAVE_TM_ZONE 1
/* Define to 1 if you have the `towlower' function. */
#define HAVE_TOWLOWER 1
/* Define to 1 if you have the external array `tzname'. */
/* #undef HAVE_TZNAME */
/* Define to 1 if you have the <ucred.h> header file. */
/* #undef HAVE_UCRED_H */
/* Define to 1 if the system has the type `uint64'. */
/* #undef HAVE_UINT64 */
/* Define to 1 if the system has the type `uint8'. */
/* #undef HAVE_UINT8 */
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if the system has the type `union semun'. */
#define HAVE_UNION_SEMUN 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have unix sockets. */
#define HAVE_UNIX_SOCKETS 1
/* Define to 1 if you have the `unsetenv' function. */
#define HAVE_UNSETENV 1
/* Define to 1 if the system has the type `unsigned long long int'. */
#define HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if you have BSD UUID support. */
/* #undef HAVE_UUID_BSD */
/* Define to 1 if you have E2FS UUID support. */
/* #undef HAVE_UUID_E2FS */
/* Define to 1 if you have the <uuid.h> header file. */
/* #undef HAVE_UUID_H */
/* Define to 1 if you have OSSP UUID support. */
/* #undef HAVE_UUID_OSSP */
/* Define to 1 if you have the <uuid/uuid.h> header file. */
/* #undef HAVE_UUID_UUID_H */
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
/* Define to 1 if you have the `wcstombs' function. */
#define HAVE_WCSTOMBS 1
/* Define to 1 if you have the `wcstombs_l' function. */
#define HAVE_WCSTOMBS_L 1
/* Define to 1 if you have the <wctype.h> header file. */
#define HAVE_WCTYPE_H 1
/* Define to 1 if you have the <winldap.h> header file. */
/* #undef HAVE_WINLDAP_H */
/* Define to 1 if your compiler understands __builtin_bswap32. */
#define HAVE__BUILTIN_BSWAP32 1
/* Define to 1 if your compiler understands __builtin_bswap64. */
#define HAVE__BUILTIN_BSWAP64 1
/* Define to 1 if your compiler understands __builtin_constant_p. */
#define HAVE__BUILTIN_CONSTANT_P 1
/* Define to 1 if your compiler understands __builtin_types_compatible_p. */
#define HAVE__BUILTIN_TYPES_COMPATIBLE_P 1
/* Define to 1 if your compiler understands __builtin_unreachable. */
#define HAVE__BUILTIN_UNREACHABLE 1
/* Define to 1 if you have __cpuid. */
/* #undef HAVE__CPUID */
/* Define to 1 if you have __get_cpuid. */
/* #undef HAVE__GET_CPUID */
/* Define to 1 if your compiler understands _Static_assert. */
#define HAVE__STATIC_ASSERT 1
/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
#define HAVE__VA_ARGS 1
/* Define to the appropriate snprintf length modifier for 64-bit ints. */
#define INT64_MODIFIER "l"
/* Define to 1 if `locale_t' requires <xlocale.h>. */
/* #undef LOCALE_T_IN_XLOCALE */
/* Define as the maximum alignment requirement of any C data type. */
#define MAXIMUM_ALIGNOF 32
/* Define bytes to use libc memset(). */
#define MEMSET_LOOP_LIMIT 1024
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "PostgreSQL"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "PostgreSQL 9.6.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "postgresql"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "9.6.1"
/* Define to the name of a signed 128-bit integer type. */
/* #undef PG_INT128_TYPE */
/* Define to the name of a signed 64-bit integer type. */
#define PG_INT64_TYPE long int
/* Define to the name of the default PostgreSQL service principal in Kerberos
(GSSAPI). (--with-krb-srvnam=NAME) */
#define PG_KRB_SRVNAM "postgres"
/* PostgreSQL major version as a string */
#define PG_MAJORVERSION "9.6"
/* Define to gnu_printf if compiler supports it, else printf. */
#define PG_PRINTF_ATTRIBUTE printf
/* PostgreSQL version as a string */
#define PG_VERSION "9.6.1"
/* PostgreSQL version as a number */
#define PG_VERSION_NUM 90601
/* A string containing the version number, platform, and C compiler */
#define PG_VERSION_STR "PostgreSQL 9.6.1 on cheri-unknown-freebsd, compiled by clang version 5.0.0 (https://github.com/CTSRD-CHERI/clang.git 520ebe16e7f8f96ccf30266dbab8d7d27c27f64d) (https://github.com/CTSRD-CHERI/llvm.git db1cf1fff6307cb2da2aa990cb1bc85bf0a171f3), 256-bit"
/* Define to 1 to allow profiling output to be saved separately for each
process. */
/* #undef PROFILE_PID_DIR */
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus,
the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger
than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be
less than your OS' limit on file size. This is often 2 GB or 4GB in a
32-bit operating system, unless you have large file support enabled. By
default, we make the limit 1 GB to avoid any possible integer-overflow
problems within the OS. A limit smaller than necessary only means we divide
a large relation into more chunks than necessary, so it seems best to err
in the direction of a small limit. A power-of-2 value is recommended to
save a few cycles in md.c, but is not absolutely required. Changing
RELSEG_SIZE requires an initdb. */
#define RELSEG_SIZE 131072
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 8
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 32
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if strerror_r() returns a int. */
#define STRERROR_R_INT 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define to 1 to build with assertion checks. (--enable-cassert) */
/* #undef USE_ASSERT_CHECKING */
/* Define to 1 to build with Bonjour support. (--with-bonjour) */
/* #undef USE_BONJOUR */
/* Define to 1 to build with BSD Authentication support. (--with-bsd-auth) */
/* #undef USE_BSD_AUTH */
/* Define to 1 if you want float4 values to be passed by value.
(--enable-float4-byval) */
#define USE_FLOAT4_BYVAL 1
/* Define to 1 if you want float8, int8, etc values to be passed by value.
(--enable-float8-byval) */
#define USE_FLOAT8_BYVAL 1
/* Define to 1 if you want 64-bit integer timestamp and interval support.
(--enable-integer-datetimes) */
#define USE_INTEGER_DATETIMES 1
/* Define to 1 to build with LDAP support. (--with-ldap) */
/* #undef USE_LDAP */
/* Define to 1 to build with XML support. (--with-libxml) */
/* #undef USE_LIBXML */
/* Define to 1 to use XSLT support when building contrib/xml2.
(--with-libxslt) */
/* #undef USE_LIBXSLT */
/* Define to select named POSIX semaphores. */
/* #undef USE_NAMED_POSIX_SEMAPHORES */
/* Define to build with OpenSSL support. (--with-openssl) */
/* #undef USE_OPENSSL */
/* Define to 1 to build with PAM support. (--with-pam) */
/* #undef USE_PAM */
/* Use replacement snprintf() functions. */
/* #undef USE_REPL_SNPRINTF */
/* Define to 1 to use Intel SSE 4.2 CRC instructions with a runtime check. */
#define USE_SLICING_BY_8_CRC32C 1
/* Define to 1 use Intel SSE 4.2 CRC instructions. */
/* #undef USE_SSE42_CRC32C */
/* Define to 1 to use Intel SSSE 4.2 CRC instructions with a runtime check. */
/* #undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK */
/* Define to build with systemd support. (--with-systemd) */
/* #undef USE_SYSTEMD */
/* Define to select SysV-style semaphores. */
#define USE_SYSV_SEMAPHORES 1
/* Define to select SysV-style shared memory. */
#define USE_SYSV_SHARED_MEMORY 1
/* Define to select unnamed POSIX semaphores. */
/* #undef USE_UNNAMED_POSIX_SEMAPHORES */
/* Define to select Win32-style semaphores. */
/* #undef USE_WIN32_SEMAPHORES */
/* Define to select Win32-style shared memory. */
/* #undef USE_WIN32_SHARED_MEMORY */
/* Define to 1 if `wcstombs_l' requires <xlocale.h>. */
#define WCSTOMBS_L_IN_XLOCALE 1
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
# 891 "../../../../src/include/pg_config.h"
#else
# 892 "../../../../src/include/pg_config.h"
# ifndef WORDS_BIGENDIAN
# define WORDS_BIGENDIAN 1
# endif
# 895 "../../../../src/include/pg_config.h"
#endif
# 896 "../../../../src/include/pg_config.h"
/* Size of a WAL file block. This need have no particular relation to BLCKSZ.
XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
buffers, else direct I/O may fail. Changing XLOG_BLCKSZ requires an initdb.
*/
#define XLOG_BLCKSZ 8192
/* XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
and larger than XLOG_BLCKSZ (preferably, a great deal larger than
XLOG_BLCKSZ). Changing XLOG_SEG_SIZE requires an initdb. */
#define XLOG_SEG_SIZE (16 * 1024 * 1024)
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
/* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
# 925 "../../../../src/include/pg_config.h"
/* Define to the type of a signed integer type wide enough to hold a pointer,
if such a type exists, and if the system does not define it. */
/* #undef intptr_t */
/* Define to empty if the C compiler does not understand signed types. */
/* #undef signed */
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
/* #undef uintptr_t */
# 54 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "pg_config_manual.h" /* must be after pg_config.h */
#endif /* expanded by -frewrite-includes */
# 54 "../../../../src/include/c.h"
# 1 "../../../../src/include/pg_config_manual.h" 1
/*------------------------------------------------------------------------
* PostgreSQL manual configuration settings
*
* This file contains various configuration symbols and limits. In
* all cases, changing them is only useful in very rare situations or
* for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted).
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/pg_config_manual.h
*------------------------------------------------------------------------
*/
/*
* Maximum length for identifiers (e.g. table names, column names,
* function names). Names actually are limited to one less byte than this,
* because the length must include a trailing zero byte.
*
* Changing this requires an initdb.
*/
#define NAMEDATALEN 64
/*
* Maximum number of arguments to a function.
*
* The minimum value is 8 (GIN indexes use 8-argument support functions).
* The maximum possible value is around 600 (limited by index tuple size in
* pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger
* than needed will waste memory and processing time, but do not directly
* cost disk space.
*
* Changing this does not require an initdb, but it does require a full
* backend recompile (including any user-defined C functions).
*/
#define FUNC_MAX_ARGS 100
/*
* Maximum number of columns in an index. There is little point in making
* this anything but a multiple of 32, because the main cost is associated
* with index tuple header size (see access/itup.h).
*
* Changing this requires an initdb.
*/
#define INDEX_MAX_KEYS 32
/*
* Set the upper and lower bounds of sequence values.
*/
#define SEQ_MAXVALUE PG_INT64_MAX
#define SEQ_MINVALUE (-SEQ_MAXVALUE)
/*
* When we don't have native spinlocks, we use semaphores to simulate them.
* Decreasing this value reduces consumption of OS resources; increasing it
* may improve performance, but supplying a real spinlock implementation is
* probably far better.
*/
#define NUM_SPINLOCK_SEMAPHORES 128
/*
* When we have neither spinlocks nor atomic operations support we're
* implementing atomic operations on top of spinlock on top of semaphores. To
* be safe against atomic operations while holding a spinlock separate
* semaphores have to be used.
*/
#define NUM_ATOMICS_SEMAPHORES 64
/*
* Define this if you want to allow the lo_import and lo_export SQL
* functions to be executed by ordinary users. By default these
* functions are only available to the Postgres superuser. CAUTION:
* These functions are SECURITY HOLES since they can read and write
* any file that the PostgreSQL server has permission to access. If
* you turn this on, don't say we didn't warn you.
*/
/* #define ALLOW_DANGEROUS_LO_FUNCTIONS */
/*
* MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
* maximum usable pathname length is one less).
*
* We'd use a standard system header symbol for this, if there weren't
* so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
* defined by different "standards", and often have different values
* on the same platform! So we just punt and use a reasonably
* generous setting here.
*/
#define MAXPGPATH 1024
/*
* PG_SOMAXCONN: maximum accept-queue length limit passed to
* listen(2). You'd think we should use SOMAXCONN from
* <sys/socket.h>, but on many systems that symbol is much smaller
* than the kernel's actual limit. In any case, this symbol need be
* twiddled only if you have a kernel that refuses large limit values,
* rather than silently reducing the value to what it can handle
* (which is what most if not all Unixen do).
*/
#define PG_SOMAXCONN 10000
/*
* You can try changing this if you have a machine with bytes of
* another size, but no guarantee...
*/
#define BITS_PER_BYTE 8
/*
* Preferred alignment for disk I/O buffers. On some CPUs, copies between
* user space and kernel space are significantly faster if the user buffer
* is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
* a platform-dependent value, but for now we just hard-wire it.
*/
#define ALIGNOF_BUFFER 32
/*
* Disable UNIX sockets for certain operating systems.
*/
#if defined(WIN32)
#undef HAVE_UNIX_SOCKETS
#endif
# 123 "../../../../src/include/pg_config_manual.h"
/*
* Define this if your operating system supports link()
*/
#if !defined(WIN32) && !defined(__CYGWIN__)
#define HAVE_WORKING_LINK 1
#endif
# 130 "../../../../src/include/pg_config_manual.h"
/*
* USE_POSIX_FADVISE controls whether Postgres will attempt to use the
* posix_fadvise() kernel call. Usually the automatic configure tests are
* sufficient, but some older Linux distributions had broken versions of
* posix_fadvise(). If necessary you can remove the #define here.
*/
#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
#define USE_POSIX_FADVISE
#endif
# 140 "../../../../src/include/pg_config_manual.h"
/*
* USE_PREFETCH code should be compiled only if we have a way to implement
* prefetching. (This is decoupled from USE_POSIX_FADVISE because there
* might in future be support for alternative low-level prefetch APIs.)
*/
#ifdef USE_POSIX_FADVISE
#define USE_PREFETCH
#endif
# 149 "../../../../src/include/pg_config_manual.h"
/*
* Default and maximum values for backend_flush_after, bgwriter_flush_after
* and checkpoint_flush_after; measured in blocks. Currently, these are
* enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
* we could also enable by default if we have mmap and msync(MS_ASYNC)?
*/
#ifdef HAVE_SYNC_FILE_RANGE
#define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */
#define DEFAULT_BGWRITER_FLUSH_AFTER 64
#define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
#else
# 161 "../../../../src/include/pg_config_manual.h"
#define DEFAULT_BACKEND_FLUSH_AFTER 0
#define DEFAULT_BGWRITER_FLUSH_AFTER 0
#define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
#endif
# 165 "../../../../src/include/pg_config_manual.h"
/* upper limit for all three variables */
#define WRITEBACK_MAX_PENDING_FLUSHES 256
/*
* USE_SSL code should be compiled only when compiling with an SSL
* implementation. (Currently, only OpenSSL is supported, but we might add
* more implementations in the future.)
*/
#ifdef USE_OPENSSL
#define USE_SSL
#endif
# 176 "../../../../src/include/pg_config_manual.h"
/*
* This is the default directory in which AF_UNIX socket files are
* placed. Caution: changing this risks breaking your existing client
* applications, which are likely to continue to look in the old
* directory. But if you just hate the idea of sockets in /tmp,
* here's where to twiddle it. You can also override this at runtime
* with the postmaster's -k switch.
*/
#define DEFAULT_PGSOCKET_DIR "/tmp"
/*
* This is the default event source for Windows event log.
*/
#define DEFAULT_EVENT_SOURCE "PostgreSQL"
/*
* The random() function is expected to yield values between 0 and
* MAX_RANDOM_VALUE. Currently, all known implementations yield
* 0..2^31-1, so we just hardwire this constant. We could do a
* configure test if it proves to be necessary. CAUTION: Think not to
* replace this with RAND_MAX. RAND_MAX defines the maximum value of
* the older rand() function, which is often different from --- and
* considerably inferior to --- random().
*/
#define MAX_RANDOM_VALUE PG_INT32_MAX
/*
* On PPC machines, decide whether to use the mutex hint bit in LWARX
* instructions. Setting the hint bit will slightly improve spinlock
* performance on POWER6 and later machines, but does nothing before that,
* and will result in illegal-instruction failures on some pre-POWER4
* machines. By default we use the hint bit when building for 64-bit PPC,
* which should be safe in nearly all cases. You might want to override
* this if you are building 32-bit code for a known-recent PPC machine.
*/
#ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */
#if defined(__ppc64__) || defined(__powerpc64__)
#define USE_PPC_LWARX_MUTEX_HINT
#endif
# 216 "../../../../src/include/pg_config_manual.h"
#endif
# 217 "../../../../src/include/pg_config_manual.h"
/*
* On PPC machines, decide whether to use LWSYNC instructions in place of
* ISYNC and SYNC. This provides slightly better performance, but will
* result in illegal-instruction failures on some pre-POWER4 machines.
* By default we use LWSYNC when building for 64-bit PPC, which should be
* safe in nearly all cases.
*/
#if defined(__ppc64__) || defined(__powerpc64__)
#define USE_PPC_LWSYNC
#endif
# 228 "../../../../src/include/pg_config_manual.h"
/*
* Assumed cache line size. This doesn't affect correctness, but can be used
* for low-level optimizations. Currently, this is used to pad some data
* structures in xlog.c, to ensure that highly-contended fields are on
* different cache lines. Too small a value can hurt performance due to false
* sharing, while the only downside of too large a value is a few bytes of
* wasted memory. The default is 128, which should be large enough for all
* supported platforms.
*/
/* XXXAR: 64 bytes???? */
#define PG_CACHE_LINE_SIZE 128
/*
*------------------------------------------------------------------------
* The following symbols are for enabling debugging code, not for
* controlling user-visible features or resource limits.
*------------------------------------------------------------------------
*/
/*
* Include Valgrind "client requests", mostly in the memory allocator, so
* Valgrind understands PostgreSQL memory contexts. This permits detecting
* memory errors that Valgrind would not detect on a vanilla build. See also
* src/tools/valgrind.supp. "make installcheck" runs 20-30x longer under
* Valgrind. Note that USE_VALGRIND slowed older versions of Valgrind by an
* additional order of magnitude; Valgrind 3.8.1 does not have this problem.
* The client requests fall in hot code paths, so USE_VALGRIND also slows
* native execution by a few percentage points.
*
* You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
* instrumentation of repalloc() is inferior without it.
*/
/* #define USE_VALGRIND */
/*
* Define this to cause pfree()'d memory to be cleared immediately, to
* facilitate catching bugs that refer to already-freed values.
* Right now, this gets defined automatically if --enable-cassert.
*/
#ifdef USE_ASSERT_CHECKING
#define CLOBBER_FREED_MEMORY
#endif
# 271 "../../../../src/include/pg_config_manual.h"
/*
* Define this to check memory allocation errors (scribbling on more
* bytes than were allocated). Right now, this gets defined
* automatically if --enable-cassert or USE_VALGRIND.
*/
#if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
#define MEMORY_CONTEXT_CHECKING
#endif
# 280 "../../../../src/include/pg_config_manual.h"
/*
* Define this to cause palloc()'d memory to be filled with random data, to
* facilitate catching code that depends on the contents of uninitialized
* memory. Caution: this is horrendously expensive.
*/
/* #define RANDOMIZE_ALLOCATED_MEMORY */
/*
* Define this to force all parse and plan trees to be passed through
* copyObject(), to facilitate catching errors and omissions in
* copyObject().
*/
/* #define COPY_PARSE_PLAN_TREES */
/*
* Define this to force all raw parse trees for DML statements to be scanned
* by raw_expression_tree_walker(), to facilitate catching errors and
* omissions in that function.
*/
/* #define RAW_EXPRESSION_COVERAGE_TEST */
/*
* Enable debugging print statements for lock-related operations.
*/
/* #define LOCK_DEBUG */
/*
* Enable debugging print statements for WAL-related operations; see
* also the wal_debug GUC var.
*/
/* #define WAL_DEBUG */
/*
* Enable tracing of resource consumption during sort operations;
* see also the trace_sort GUC var. For 8.1 this is enabled by default.
*/
#define TRACE_SORT 1
/*
* Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
*/
/* #define TRACE_SYNCSCAN */
/*
* Other debug #defines (documentation, anyone?)
*/
/* #define HEAPDEBUGALL */
/* #define ACLDEBUG */
# 55 "../../../../src/include/c.h" 2
/*
* We always rely on the WIN32 macro being set by our build system,
* but _WIN32 is the compiler pre-defined macro. So make sure we define
* WIN32 whenever _WIN32 is set, to facilitate standalone building.
*/
#if defined(_WIN32) && !defined(WIN32)
#define WIN32
#endif
# 64 "../../../../src/include/c.h"
#if !defined(WIN32) && !defined(__CYGWIN__) /* win32 includes further down */
#if 0 /* expanded by -frewrite-includes */
#include "pg_config_os.h" /* must be before any system header files */
#endif /* expanded by -frewrite-includes */
# 66 "../../../../src/include/c.h"
# 1 "../../../../src/include/pg_config_os.h" 1
/* src/include/port/freebsd.h */
# 67 "../../../../src/include/c.h" 2
#endif
# 68 "../../../../src/include/c.h"
#if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
#define errcode __msvc_errcode
#if 0 /* expanded by -frewrite-includes */
#include <crtdefs.h>
#endif /* expanded by -frewrite-includes */
# 71 "../../../../src/include/c.h"
# 72 "../../../../src/include/c.h"
#undef errcode
#endif
# 74 "../../../../src/include/c.h"
/*
* We have to include stdlib.h here because it defines many of these macros
* on some platforms, and we only want our definitions used if stdlib.h doesn't
* have its own. The same goes for stddef and stdarg if present.
*/
#if 0 /* expanded by -frewrite-includes */
#include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 81 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdio.h 8.5 (Berkeley) 4/29/95
* $FreeBSD$
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 1 3 4
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
* $FreeBSD$
*/
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
/*
* Testing against Clang-specific extensions.
*/
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_extension
#define __has_extension __has_feature
#endif
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_feature
#define __has_feature(x) 0
#endif
# 51 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_include
#define __has_include(x) 0
#endif
# 54 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __BEGIN_DECLS
#define __END_DECLS
#endif
# 65 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* This code has been put in place to help reduce the addition of
* compiler specific defines in FreeBSD code. It helps to aid in
* having a compiler-agnostic source tree.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
#define __GNUCLIKE_ASM 3
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
#else
# 78 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_ASM 2
#endif
# 80 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE___TYPEOF 1
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1
#ifndef __INTEL_COMPILER
#define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif
# 87 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
__INTEL_COMPILER < 800
#undef __GNUCLIKE_BUILTIN_CONSTANT_P
#endif
# 93 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define __GNUCLIKE_BUILTIN_VARARGS 1
#define __GNUCLIKE_BUILTIN_STDARG 1
#define __GNUCLIKE_BUILTIN_VAALIST 1
#endif
# 99 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__GNUC__)
#define __GNUC_VA_LIST_COMPATIBILITY 1
#endif
# 103 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler memory barriers, specific to gcc and clang.
*/
#if defined(__GNUC__)
#define __compiler_membar() __asm __volatile(" " : : : "memory")
#endif
# 110 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __INTEL_COMPILER
#define __GNUCLIKE_BUILTIN_NEXT_ARG 1
#define __GNUCLIKE_MATH_BUILTIN_RELOPS
#endif
# 115 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_BUILTIN_MEMCPY 1
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
#define __CC_SUPPORTS_INLINE 1
#define __CC_SUPPORTS___INLINE 1
#define __CC_SUPPORTS___INLINE__ 1
#define __CC_SUPPORTS___FUNC__ 1
#define __CC_SUPPORTS_WARNING 1
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
#endif /* __GNUC__ || __INTEL_COMPILER */
# 131 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Macro to test if we're using a specific version of gcc or later.
*/
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define __GNUC_PREREQ__(ma, mi) \
(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
#else
# 139 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUC_PREREQ__(ma, mi) 0
#endif
# 141 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
* mode -- there must be no spaces between its arguments, and for nested
* __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
* concatenate double-quoted strings produced by the __STRING macro, but
* this only works with ANSI C.
*
* __XSTRING is like __STRING, but it expands any macros in its argument
* first. It is only available with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT1(x,y) x ## y
#define __CONCAT(x,y) __CONCAT1(x,y)
#define __STRING(x) #x /* stringify without expanding x */
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
# 167 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !(defined(__CC_SUPPORTS___INLINE))
#define __inline /* delete GCC keyword */
#endif /* ! __CC_SUPPORTS___INLINE */
# 170 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !__cplusplus */
# 171 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#else /* !(__STDC__ || __cplusplus) */
# 173 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#if !defined(__CC_SUPPORTS___INLINE)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#ifndef NO_ANSI_KEYWORDS
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif /* !NO_ANSI_KEYWORDS */
# 196 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !__CC_SUPPORTS___INLINE */
# 197 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !(__STDC__ || __cplusplus) */
# 198 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler-dependent macros to help declare dead (non-returning) and
* pure (no side effects) functions, and unused variables. They are
* null except for versions of gcc that are known to support the features
* properly (old versions of gcc-2 supported the dead and pure features
* in a different (wrong) way). If we do not provide an implementation
* for a given compiler, let the compile fail if it is told to use
* a feature that we cannot live without.
*/
#ifdef lint
#define __dead2
#define __pure2
#define __unused
#define __packed
#define __aligned(x)
#define __alloc_align(x)
#define __alloc_size(x)
#define __section(x)
#define __weak_symbol
#else
# 219 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __weak_symbol __attribute__((__weak__))
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
#define __dead2
#define __pure2
#define __unused
#endif
# 225 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused
/* XXX Find out what to do for __packed, __aligned and __section */
#endif
# 231 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
# 240 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
#define __alloc_size(x) __attribute__((__alloc_size__(x)))
#else
# 243 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __alloc_size(x)
#endif
# 245 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
#define __alloc_align(x) __attribute__((__alloc_align__(x)))
#else
# 248 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __alloc_align(x)
#endif
# 250 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* lint */
# 251 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__GNUC_PREREQ__(2, 95)
#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
#endif
# 255 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Keywords added in C11.
*/
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
#if !__has_extension(c_alignas)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_alignas)
#define _Alignas(x) alignas(x)
#else
# 267 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
#define _Alignas(x) __aligned(x)
#endif
# 270 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 271 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Alignof(x) alignof(x)
#else
# 275 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Alignof(x) __alignof(x)
#endif
# 277 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !defined(__cplusplus) && !__has_extension(c_atomic) && \
!__has_extension(cxx_atomic)
/*
* No native support for _Atomic(). Place object in structure to prevent
* most forms of direct non-atomic access.
*/
#define _Atomic(T) struct { T volatile __val; }
#endif
# 286 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Noreturn [[noreturn]]
#else
# 290 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Noreturn __dead2
#endif
# 292 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__has_extension(c_static_assert)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
#define _Static_assert(x, y) static_assert(x, y)
#elif __GNUC_PREREQ__(4,6)
# 298 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#elif defined(__COUNTER__)
# 300 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
#define __Static_assert(x, y) ___Static_assert(x, y)
#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
__unused
#else
# 305 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Static_assert(x, y) struct __hack
#endif
# 307 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 308 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__has_extension(c_thread_local)
/*
* XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode
* without actually supporting the thread_local keyword. Don't check for
* the presence of C++11 when defining _Thread_local.
*/
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
__has_extension(cxx_thread_local)
#define _Thread_local thread_local
#else
# 319 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Thread_local __thread
#endif
# 321 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 322 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
# 324 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Emulation of C11 _Generic(). Unlike the previously defined C11
* keywords, it is not possible to implement this using exactly the same
* syntax. Therefore implement something similar under the name
* __generic(). Unlike _Generic(), this macro can only distinguish
* between a single type, so it requires nested invocations to
* distinguish multiple cases.
*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
__has_extension(c_generic_selections)
#define __generic(expr, t, yes, no) \
_Generic(expr, t: yes, default: no)
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
# 339 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __generic(expr, t, yes, no) \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(expr), t), yes, no)
#endif
# 343 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* C99 Static array indices in function parameter declarations. Syntax such as:
* void bar(int myArray[static 10]);
* is allowed in C99 but not in C++. Define __min_size appropriately so
* headers using it can be compiled in either language. Use like this:
* void bar(int myArray[__min_size(10)]);
*/
#if !defined(__cplusplus) && \
(defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
(!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
#define __min_size(x) static (x)
#else
# 356 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __min_size(x) (x)
#endif
# 358 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(2, 96)
#define __malloc_like __attribute__((__malloc__))
#define __pure __attribute__((__pure__))
#else
# 363 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __malloc_like
#define __pure
#endif
# 366 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __always_inline __attribute__((__always_inline__))
#else
# 370 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __always_inline
#endif
# 372 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 1)
#define __noinline __attribute__ ((__noinline__))
#else
# 376 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __noinline
#endif
# 378 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 4)
#define __fastcall __attribute__((__fastcall__))
#define __result_use_check __attribute__((__warn_unused_result__))
#else
# 383 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __fastcall
#define __result_use_check
#endif
# 386 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((__returns_twice__))
#else
# 390 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __returns_twice
#endif
# 392 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
#define __unreachable() __builtin_unreachable()
#else
# 396 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __unreachable() ((void)0)
#endif
# 398 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL
#endif
# 403 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
#define __LONG_LONG_SUPPORTED
#endif
# 407 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* C++11 exposes a load of C99 stuff */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define __LONG_LONG_SUPPORTED
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
# 414 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
# 417 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 418 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* GCC 2.95 provides `__restrict' as an extension to C90 to support the
* C99-specific `restrict' type qualifier. We happen to use `__restrict' as
* a way to define the `restrict' type qualifier without disturbing older
* software that is unaware of C99 keywords.
*/
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
#define __restrict
#else
# 429 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __restrict restrict
#endif
# 431 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 432 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that
* code blocks can be reordered such that the predicted path
* sees a more linear flow, thus improving cache behavior, etc.
*
* The following two macros provide us with a way to utilize this
* compiler feature. Use __predict_true() if you expect the expression
* to evaluate to true, and __predict_false() if you expect the
* expression to evaluate to false.
*
* A few notes about usage:
*
* * Generally, __predict_false() error condition checks (unless
* you have some _strong_ reason to do otherwise, in which case
* document it), and/or __predict_true() `no-error' condition
* checks, assuming you want to optimize for the no-error case.
*
* * Other than that, if you don't know the likelihood of a test
* succeeding from empirical or other `hard' evidence, don't
* make predictions.
*
* * These are meant to be used in places that are run `a lot'.
* It is wasteful to make predictions in code that is run
* seldomly (e.g. at subsystem initialization time) as the
* basic block reordering that this affects can often generate
* larger code.
*/
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp) __builtin_expect((exp), 1)
#define __predict_false(exp) __builtin_expect((exp), 0)
#else
# 465 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __predict_true(exp) (exp)
#define __predict_false(exp) (exp)
#endif
# 468 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 0)
#define __null_sentinel __attribute__((__sentinel__))
#define __exported __attribute__((__visibility__("default")))
#define __hidden __attribute__((__visibility__("hidden")))
#else
# 474 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __null_sentinel
#define __exported
#define __hidden
#endif
# 478 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
* require it.
*/
#if __GNUC_PREREQ__(4, 1)
#define __offsetof(type, field) __builtin_offsetof(type, field)
#else
# 486 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __cplusplus
#define __offsetof(type, field) \
((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
#else
# 490 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __offsetof(type, field) \
(__offsetof__ (reinterpret_cast <__size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<type *> (0)->field))))
#endif
# 495 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 496 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __rangeof(type, start, end) \
(__offsetof(type, end) - __offsetof(type, start))
/*
* Given the pointer x to the member m of the struct s, return
* a pointer to the containing structure. When using GCC, we first
* assign pointer x to a local variable, to check that its type is
* compatible with member m.
*/
#if __GNUC_PREREQ__(3, 1)
#define __containerof(x, s, m) ({ \
const volatile __typeof(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
})
#else
# 511 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __containerof(x, s, m) \
__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
#endif
# 514 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler-dependent macros to declare that functions take printf-like
* or scanf-like arguments. They are null except for versions of gcc
* that are known to support the features properly (old versions of gcc-2
* didn't permit keeping the keywords out of the application namespace).
*/
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __printflike(fmtarg, firstvararg)
#define __scanflike(fmtarg, firstvararg)
#define __format_arg(fmtarg)
#define __strfmonlike(fmtarg, firstvararg)
#define __strftimelike(fmtarg, firstvararg)
#else
# 528 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __printflike(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#define __scanflike(fmtarg, firstvararg) \
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
#define __strfmonlike(fmtarg, firstvararg) \
__attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
#define __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
#endif
# 538 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
#else
# 545 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __printf0like(fmtarg, firstvararg)
#endif
# 547 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef __INTEL_COMPILER
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
# 553 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@" #verid)
#define __sym_default(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@@" #verid)
#else
# 566 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
__asm__(".equ alias, sym")
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver impl, sym@verid")
#define __sym_default(impl,sym,verid) \
__asm__(".symver impl, sym@@verid")
#endif /* __STDC__ */
# 578 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* __GNUC__ || __INTEL_COMPILER */
# 579 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GLOBL1(sym) __asm__(".globl " #sym)
#define __GLOBL(sym) __GLOBL1(sym)
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
#else
# 586 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* The following definition might not work well if used in header files,
* but it should be better than nothing. If you want a "do nothing"
* version, then it should generate some harmless declaration, such as:
* #define __IDSTRING(name,string) struct __hack
*/
#define __IDSTRING(name,string) static const char name[] __unused = string
#endif
# 594 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Embed the rcs id of a source file in the resulting library. Note that in
* more recent ELF binutils, we use .ident allowing the ID to be stripped.
* Usage:
* __FBSDID("$FreeBSD$");
*/
#ifndef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 605 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __FBSDID(s) struct __hack
#endif
# 607 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 608 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __RCSID
#ifndef NO__RCSID
#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 613 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __RCSID(s) struct __hack
#endif
# 615 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 616 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __RCSID_SOURCE
#ifndef NO__RCSID_SOURCE
#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
#else
# 621 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __RCSID_SOURCE(s) struct __hack
#endif
# 623 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 624 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __SCCSID
#ifndef NO__SCCSID
#define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
#else
# 629 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __SCCSID(s) struct __hack
#endif
# 631 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 632 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __COPYRIGHT
#ifndef NO__COPYRIGHT
#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
#else
# 637 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __COPYRIGHT(s) struct __hack
#endif
# 639 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 640 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DECONST
#if !__has_feature(capabilities)
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#else
# 645 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DECONST(type, var) ((type)(__intcap_t)(__capability const void *)(var))
#endif
# 647 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 648 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DEVOLATILE
#if !__has_feature(capabilities)
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
#else
# 653 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DEVOLATILE(type, var) ((type)(__intcap_t)(__capability volatile void *)(var))
#endif
# 655 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 656 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DEQUALIFY
#if !__has_feature(capabilities)
#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
#else
# 661 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DEQUALIFY(type, var) ((type)(__intcap_t)(__capability const volatile void *)(var))
#endif
# 663 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 664 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*-
* The following definitions are an extension of the behavior originally
* implemented in <sys/_posix.h>, but with a different level of granularity.
* POSIX.1 requires that the macros we test be defined before any standard
* header file is included.
*
* Here's a quick run-down of the versions:
* defined(_POSIX_SOURCE) 1003.1-1988
* _POSIX_C_SOURCE == 1 1003.1-1990
* _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
* _POSIX_C_SOURCE == 199309 1003.1b-1993
* _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
* and the omnibus ISO/IEC 9945-1: 1996
* _POSIX_C_SOURCE == 200112 1003.1-2001
* _POSIX_C_SOURCE == 200809 1003.1-2008
*
* In addition, the X/Open Portability Guide, which is now the Single UNIX
* Specification, defines a feature-test macro which indicates the version of
* that specification, and which subsumes _POSIX_C_SOURCE.
*
* Our macros begin with two underscores to avoid namespace screwage.
*/
/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
#define _POSIX_C_SOURCE 199009
#endif
# 693 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199209
#endif
# 699 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
#ifdef _XOPEN_SOURCE
#if _XOPEN_SOURCE - 0 >= 700
#define __XSI_VISIBLE 700
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809
#elif _XOPEN_SOURCE - 0 >= 600
# 707 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __XSI_VISIBLE 600
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112
#elif _XOPEN_SOURCE - 0 >= 500
# 711 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __XSI_VISIBLE 500
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199506
#endif
# 715 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 716 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Deal with all versions of POSIX. The ordering relative to the tests above is
* important.
*/
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 198808
#endif
# 724 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 200809
#define __POSIX_VISIBLE 200809
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 200112
# 729 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 200112
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 199506
# 732 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199506
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199309
# 735 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199309
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199209
# 738 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199209
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199009
# 741 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199009
#define __ISO_C_VISIBLE 1990
#else
# 744 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 198808
#define __ISO_C_VISIBLE 0
#endif /* _POSIX_C_SOURCE */
# 747 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#else
# 748 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*-
* Deal with _ANSI_SOURCE:
* If it is defined, and no other compilation environment is explicitly
* requested, then define our internal feature-test macros to zero. This
* makes no difference to the preprocessor (undefined symbols in preprocessing
* expressions are defined to have value zero), but makes it more convenient for
* a test program to print out the values.
*
* If a program mistakenly defines _ANSI_SOURCE and some other macro such as
* _POSIX_C_SOURCE, we will assume that it wants the broader compilation
* environment (and in fact we will never get here).
*/
#if defined(_ANSI_SOURCE) /* Hide almost everything. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1990
#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
# 766 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1999
#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
# 771 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
#else /* Default environment: show everything. */
# 776 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
#define __ISO_C_VISIBLE 2011
#endif
# 781 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 782 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__mips) || defined(__powerpc64__) || defined(__riscv__)
#define __NO_TLS 1
#endif
# 786 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Old versions of GCC use non-standard ARM arch symbols; acle-compat.h
* translates them to __ARM_ARCH and the modern feature symbols defined by ARM.
*/
#if defined(__arm__) && !defined(__ARM_ARCH)
#if 0 /* expanded by -frewrite-includes */
#include <machine/acle-compat.h>
#endif /* expanded by -frewrite-includes */
# 792 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
# 793 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 794 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Nullability qualifiers: currently only supported by Clang.
*/
#if !(defined(__clang__) && __has_feature(nullability))
#define _Nonnull
#define _Nullable
#define _Null_unspecified
#define __NULLABILITY_PRAGMA_PUSH
#define __NULLABILITY_PRAGMA_POP
#else
# 805 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
#endif
# 809 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Type Safety Checking
*
* Clang provides additional attributes to enable checking type safety
* properties that cannot be enforced by the C type system.
*/
#if __has_attribute(__argument_with_type_tag__) && \
__has_attribute(__type_tag_for_datatype__) && !defined(lint)
#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
__attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
#define __datatype_type_tag(kind, type) \
__attribute__((__type_tag_for_datatype__(kind, type)))
#else
# 824 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
#define __datatype_type_tag(kind, type)
#endif
# 827 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Lock annotations.
*
* Clang provides support for doing basic thread-safety tests at
* compile-time, by marking which locks will/should be held when
* entering/leaving a functions.
*
* Furthermore, it is also possible to annotate variables and structure
* members to enforce that they are only accessed when certain locks are
* held.
*/
#if __has_extension(c_thread_safety_attributes)
#define __lock_annotate(x) __attribute__((x))
#else
# 843 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __lock_annotate(x)
#endif
# 845 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Structure implements a lock. */
#define __lockable __lock_annotate(lockable)
/* Function acquires an exclusive or shared lock. */
#define __locks_exclusive(...) \
__lock_annotate(exclusive_lock_function(__VA_ARGS__))
#define __locks_shared(...) \
__lock_annotate(shared_lock_function(__VA_ARGS__))
/* Function attempts to acquire an exclusive or shared lock. */
#define __trylocks_exclusive(...) \
__lock_annotate(exclusive_trylock_function(__VA_ARGS__))
#define __trylocks_shared(...) \
__lock_annotate(shared_trylock_function(__VA_ARGS__))
/* Function releases a lock. */
#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
/* Function asserts that an exclusive or shared lock is held. */
#define __asserts_exclusive(...) \
__lock_annotate(assert_exclusive_lock(__VA_ARGS__))
#define __asserts_shared(...) \
__lock_annotate(assert_shared_lock(__VA_ARGS__))
/* Function requires that an exclusive or shared lock is or is not held. */
#define __requires_exclusive(...) \
__lock_annotate(exclusive_locks_required(__VA_ARGS__))
#define __requires_shared(...) \
__lock_annotate(shared_locks_required(__VA_ARGS__))
#define __requires_unlocked(...) \
__lock_annotate(locks_excluded(__VA_ARGS__))
/* Function should not be analyzed. */
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
/* Guard variables and structure members by lock. */
#define __guarded_by(x) __lock_annotate(guarded_by(x))
#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
/* Specify that a file requires capabilities */
#if __has_feature(capabilities)
#define __REQUIRE_CAPABILITIES
#else
# 889 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __REQUIRE_CAPABILITIES \
_Pragma("GCC error \"This file requires a capability-aware compiler\"")
#endif
# 892 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !_SYS_CDEFS_H_ */
# 894 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 1 3 4
/*-
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef NULL
#if !defined(__cplusplus)
#define NULL ((void *)0)
#else
# 34 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#if __cplusplus >= 201103L
#define NULL nullptr
#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#define NULL __null
#else
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#if defined(__LP64__)
#define NULL (0L)
#else
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#define NULL 0
#endif /* __LP64__ */
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif /* __GNUG__ */
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif /* !__cplusplus */
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_null.h" 3 4
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 32 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From: @(#)ansi.h 8.2 (Berkeley) 1/4/94
* From: @(#)types.h 8.3 (Berkeley) 1/5/94
* from: src/sys/i386/include/_types.h,v 1.12 2005/07/02 23:13:31 thompsa
* $FreeBSD$
*/
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/*
* Basic types upon which most other types are built.
*/
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#ifdef __mips_n64
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifndef lint
__extension__
#endif
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
# 68 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/* LONGLONG */
typedef unsigned long long __uint64_t;
#endif
# 71 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/*
* Standard type definitions.
*/
typedef __int32_t __clock_t; /* clock()... */
typedef double __double_t;
typedef float __float_t;
#ifdef __mips_n64
#ifndef __CHERI_PURE_CAPABILITY__
typedef __int64_t __critical_t;
typedef __int64_t __intfptr_t;
typedef __int64_t __intptr_t;
#else
# 84 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __intcap_t __critical_t;
typedef __intcap_t __intfptr_t;
typedef __intcap_t __intptr_t;
#endif
# 88 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#else
# 89 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __critical_t;
typedef __int32_t __intfptr_t;
typedef __int32_t __intptr_t;
#endif
# 93 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int64_t __intmax_t;
typedef __int32_t __int_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __int8_t __int_least8_t;
typedef __int16_t __int_least16_t;
typedef __int32_t __int_least32_t;
typedef __int64_t __int_least64_t;
#if defined(__mips_n64) || defined(__mips_n32)
typedef __int64_t __register_t;
typedef __int64_t f_register_t;
#else
# 106 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __register_t;
typedef __int32_t f_register_t;
#endif
# 109 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifdef __mips_n64
typedef __int64_t __ptrdiff_t;
typedef __int64_t __segsz_t;
typedef __uint64_t __size_t;
typedef __int64_t __ssize_t;
#ifndef __CHERI_PURE_CAPABILITY__
typedef __uint64_t __uintfptr_t;
typedef __uint64_t __uintptr_t;
#else
# 118 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uintcap_t __uintfptr_t;
typedef __uintcap_t __uintptr_t;
#endif
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#else
# 122 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */
typedef __int32_t __segsz_t; /* segment size (in pages) */
typedef __uint32_t __size_t; /* sizeof() */
typedef __int32_t __ssize_t; /* byte count or error */
typedef __uint32_t __uintfptr_t;
typedef __uint32_t __uintptr_t;
#endif
# 129 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int64_t __time_t; /* time()... */
typedef __uint64_t __uintmax_t;
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
typedef __uint64_t __uint_fast64_t;
typedef __uint8_t __uint_least8_t;
typedef __uint16_t __uint_least16_t;
typedef __uint32_t __uint_least32_t;
typedef __uint64_t __uint_least64_t;
#if defined(__mips_n64) || defined(__mips_n32)
typedef __uint64_t __u_register_t;
#else
# 142 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __u_register_t;
#endif
# 144 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifdef __mips_n64
typedef __uint64_t __vm_offset_t;
typedef __uint64_t __vm_size_t;
#else
# 148 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __vm_offset_t;
typedef __uint32_t __vm_size_t;
#endif
# 151 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */
typedef __uint64_t __vm_paddr_t;
#else
# 154 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __vm_paddr_t;
#endif
# 156 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef int ___wchar_t;
#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */
#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */
/*
* Unusual type definitions.
*/
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
# 168 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef char * __va_list;
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
# 170 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif
# 175 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#endif /* !_MACHINE__TYPES_H_ */
# 177 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_types.h" 3 4
# 34 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 2 3 4
/*
* Standard type definitions.
*/
typedef __int32_t __blksize_t; /* file block size */
typedef __int64_t __blkcnt_t; /* file block count */
typedef __int32_t __clockid_t; /* clock_gettime()... */
typedef __uint32_t __fflags_t; /* file flags */
typedef __uint64_t __fsblkcnt_t;
typedef __uint64_t __fsfilcnt_t;
typedef __uint32_t __gid_t;
typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */
typedef __uint32_t __ino_t; /* inode number */
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */
typedef __uint16_t __mode_t; /* permissions */
typedef int __accmode_t; /* access permissions */
typedef int __nl_item;
typedef __uint16_t __nlink_t; /* link count */
typedef __int64_t __off_t; /* file offset */
typedef __int64_t __off64_t; /* file offset (alias) */
typedef __int32_t __pid_t; /* process [group] */
typedef __int64_t __rlim_t; /* resource limit - intentionally */
/* signed, because of legacy code */
/* that uses -1 for RLIM_INFINITY */
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef long __suseconds_t; /* microseconds (signed) */
typedef struct __timer *__timer_t; /* timer_gettime()... */
typedef struct __mq *__mqd_t; /* mq_open()... */
typedef __uint32_t __uid_t;
typedef unsigned int __useconds_t; /* microseconds (unsigned) */
typedef int __cpuwhich_t; /* which parameter for cpuset. */
typedef int __cpulevel_t; /* level parameter for cpuset. */
typedef int __cpusetid_t; /* cpuset identifier. */
/*
* Unusual type definitions.
*/
/*
* rune_t is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use __ct_rune_t instead of int.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
* be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and
* rune_t must be the same type. Also, wint_t should be able to hold all
* members of the largest character set plus one extra value (WEOF), and
* must be at least 16 bits.
*/
typedef int __ct_rune_t; /* arg type for ctype funcs */
typedef __ct_rune_t __rune_t; /* rune_t (see above) */
typedef __ct_rune_t __wint_t; /* wint_t (see above) */
/* Clang already provides these types as built-ins, but only in C++ mode. */
#if !defined(__clang__) || !defined(__cplusplus)
typedef __uint_least16_t __char16_t;
typedef __uint_least32_t __char32_t;
#endif
# 97 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
/* In C++11, char16_t and char32_t are built-in types. */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _CHAR16_T_DECLARED
#define _CHAR32_T_DECLARED
#endif
# 102 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
typedef struct {
long long __max_align1 __aligned(_Alignof(long long));
long double __max_align2 __aligned(_Alignof(long double));
} __max_align_t;
typedef __uint32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
/*
* mbstate_t is an opaque object to keep conversion state during multibyte
* stream conversions.
*/
typedef union {
char __mbstate8[128];
__int64_t _mbstateL; /* for alignment */
} __mbstate_t;
typedef __uintmax_t __rman_res_t;
#endif /* !_SYS__TYPES_H_ */
# 124 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 2 3 4
__NULLABILITY_PRAGMA_PUSH
typedef __off_t fpos_t;
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 51 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200809
#ifndef _OFF_T_DECLARED
#define _OFF_T_DECLARED
typedef __off_t off_t;
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _SSIZE_T_DECLARED
#define _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _OFF64_T_DECLARED
#define _OFF64_T_DECLARED
typedef __off64_t off64_t;
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;
#define _VA_LIST_DECLARED
#endif
# 73 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 74 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define _FSTDIO /* Define for new stdio with functions. */
/*
* NB: to fit things in six character monocase externals, the stdio
* code uses the prefix `__s' for stdio objects, typically followed
* by a three-character attempt at a mnemonic.
*/
/* stdio buffers */
struct __sbuf {
unsigned char *_base;
int _size;
};
/*
* stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*
* Certain members of __sFILE are accessed directly via macros or
* inline functions. To preserve ABI compat, these members must not
* be disturbed. These members are marked below with (*).
*/
struct __sFILE {
unsigned char *_p; /* (*) current position in (some) buffer */
int _r; /* (*) read space left for getc() */
int _w; /* (*) write space left for putc() */
short _flags; /* (*) flags, below; this FILE is free if 0 */
short _file; /* (*) fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */
/* operations */
void *_cookie; /* (*) cookie passed to io functions */
int (* _Nullable _close)(void *);
int (* _Nullable _read)(void *, char *, int);
fpos_t (* _Nullable _seek)(void *, fpos_t, int);
int (* _Nullable _write)(void *, const char *, int);
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetln() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetln() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
fpos_t _offset; /* current lseek offset */
struct pthread_mutex *_fl_mutex; /* used for MT-safety */
struct pthread *_fl_owner; /* current owner */
int _fl_count; /* recursive lock count */
int _orientation; /* orientation for fwide() */
__mbstate_t _mbstate; /* multibyte conversion state */
int _flags2; /* additional flags */
};
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
# 160 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
__END_DECLS
#define _STDSTREAM_DECLARED
#endif
# 168 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
#define __SRD 0x0004 /* OK to read */
#define __SWR 0x0008 /* OK to write */
/* RD and WR are never simultaneously asserted */
#define __SRW 0x0010 /* open for reading & writing */
#define __SEOF 0x0020 /* found EOF */
#define __SERR 0x0040 /* found error */
#define __SMBF 0x0080 /* _bf._base is from malloc */
#define __SAPP 0x0100 /* fdopen()ed in append mode */
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
#define __SOPT 0x0400 /* do fseek() optimization */
#define __SNPT 0x0800 /* do not do fseek() optimization */
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
#define __SMOD 0x2000 /* true => fgetln modified _p text */
#define __SALC 0x4000 /* allocate string space dynamically */
#define __SIGN 0x8000 /* ignore this file in _fwalk */
#define __S2OAP 0x0001 /* O_APPEND mode is set */
/*
* The following three definitions are for ANSI C, which took them
* from System V, which brilliantly took internal interface macros and
* made them official arguments to setvbuf(), without renaming them.
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
*
* Although numbered as their counterparts above, the implementation
* does not rely on this.
*/
#define _IOFBF 0 /* setvbuf should set fully buffered */
#define _IOLBF 1 /* setvbuf should set line buffered */
#define _IONBF 2 /* setvbuf should set unbuffered */
#define BUFSIZ 1024 /* size of buffer used by setbuf */
#define EOF (-1)
/*
* FOPEN_MAX is a minimum maximum, and is the number of streams that
* stdio can provide without attempting to allocate further resources
* (which could fail). Do not use this for anything.
*/
/* must be == _POSIX_STREAM_MAX <limits.h> */
#ifndef FOPEN_MAX
#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
#endif
# 214 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __XSI_VISIBLE
#define P_tmpdir "/tmp/"
#endif
# 220 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
#define TMP_MAX 308915776
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#endif
# 226 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef SEEK_CUR
#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
# 229 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef SEEK_END
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
# 232 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define stdin __stdinp
#define stdout __stdoutp
#define stderr __stderrp
__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdio.h>
#endif /* expanded by -frewrite-includes */
# 239 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
# 240 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 241 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions defined in ANSI C standard.
*/
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE * __restrict, fpos_t * __restrict);
char *fgets(char * __restrict, int, FILE * __restrict);
FILE *fopen(const char * __restrict, const char * __restrict);
int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3);
int fputc(int, FILE *);
int fputs(const char * __restrict, FILE * __restrict);
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3);;
int fseek(FILE *, long, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
int getc(FILE *);
int getchar(void);
char *gets(char *);
void perror(const char *);
int printf(const char * __restrict, ...) __printflike(1, 2);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char * __restrict, ...) __scanflike(1, 2);
void setbuf(FILE * __restrict, char * __restrict);
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3);
int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE * __restrict, const char * __restrict,
__va_list);
int vprintf(const char * __restrict, __va_list);
int vsprintf(char * __restrict, const char * __restrict,
__va_list);
#if __ISO_C_VISIBLE >= 1999
int snprintf(char * __restrict, size_t, const char * __restrict,
...) __printflike(3, 4);
int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
int vsnprintf(char * __restrict, size_t, const char * __restrict,
__va_list) __printflike(3, 0);
int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
#endif
# 299 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions defined in all versions of POSIX 1003.1.
*/
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506)
#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */
#endif
# 306 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE
#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */
char *ctermid(char *);
FILE *fdopen(int, const char *);
int fileno(FILE *);
#endif /* __POSIX_VISIBLE */
# 314 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199209
int pclose(FILE *);
FILE *popen(const char *, const char *);
#endif
# 319 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199506
int ftrylockfile(FILE *);
void flockfile(FILE *);
void funlockfile(FILE *);
/*
* These are normally used through macros as defined below, but POSIX
* requires functions as well.
*/
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#endif
# 334 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __BSD_VISIBLE
void clearerr_unlocked(FILE *);
int feof_unlocked(FILE *);
int ferror_unlocked(FILE *);
int fileno_unlocked(FILE *);
#endif
# 340 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200112
int fseeko(FILE *, __off_t, int);
__off_t ftello(FILE *);
#endif
# 345 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
int getw(FILE *);
int putw(int, FILE *);
#endif /* BSD or X/Open before issue 6 */
# 350 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __XSI_VISIBLE
char *tempnam(const char *, const char *);
#endif
# 354 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200809
FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
FILE * __restrict);
FILE *open_memstream(char **, size_t *);
int renameat(int, const char *, int, const char *);
int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0);
/* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
int dprintf(int, const char * __restrict, ...) __printflike(2, 3);
#endif /* __POSIX_VISIBLE >= 200809 */
# 366 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Routines that are purely local.
*/
#if __BSD_VISIBLE
int asprintf(char **, const char *, ...) __printflike(2, 3);
char *ctermid_r(char *);
void fcloseall(void);
int fdclose(FILE *, int *);
char *fgetln(FILE *, size_t *);
const char *fmtcheck(const char *, const char *) __format_arg(2);
int fpurge(FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
int vasprintf(char **, const char *, __va_list)
__printflike(2, 0);
/*
* The system error table contains messages for the first sys_nerr
* positive errno values. Use strerror() or strerror_r() from <string.h>
* instead.
*/
extern const int sys_nerr;
extern const char * const sys_errlist[];
/*
* Stdio function-access interface.
*/
FILE *funopen(const void *,
int (* _Nullable)(void *, char *, int),
int (* _Nullable)(void *, const char *, int),
fpos_t (* _Nullable)(void *, fpos_t, int),
int (* _Nullable)(void *));
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
typedef __ssize_t cookie_read_function_t(void *, char *, size_t);
typedef __ssize_t cookie_write_function_t(void *, const char *, size_t);
typedef int cookie_seek_function_t(void *, off64_t *, int);
typedef int cookie_close_function_t(void *);
typedef struct {
cookie_read_function_t *read;
cookie_write_function_t *write;
cookie_seek_function_t *seek;
cookie_close_function_t *close;
} cookie_io_functions_t;
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
/*
* Portability hacks. See <sys/types.h>.
*/
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, __off_t);
#endif
# 421 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _LSEEK_DECLARED
#define _LSEEK_DECLARED
__off_t lseek(int, __off_t, int);
#endif
# 425 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
void *mmap(void *, size_t, int, int, int, __off_t);
#endif
# 429 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, __off_t);
#endif
# 433 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif /* __BSD_VISIBLE */
# 434 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions internal to the implementation.
*/
int __srget(FILE *);
int __swbuf(int, FILE *);
/*
* The __sfoo macros are here so that we can
* define function versions in the C library.
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__) && defined(__STDC__)
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
#else
# 454 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* This has been tuned to generate reasonable code on the vax using pcc.
*/
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
# 466 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
extern int __isthreaded;
#ifndef __cplusplus
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
#if __POSIX_VISIBLE
#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
#endif
# 484 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
#define getchar() getc(stdin)
#define putchar(x) putc(x, stdout)
#if __BSD_VISIBLE
/*
* See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
* B.8.2.7 for the rationale behind the *_unlocked() macros.
*/
#define feof_unlocked(p) __sfeof(p)
#define ferror_unlocked(p) __sferror(p)
#define clearerr_unlocked(p) __sclearerr(p)
#define fileno_unlocked(p) __sfileno(p)
#endif
# 501 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199506
#define getc_unlocked(fp) __sgetc(fp)
#define putc_unlocked(x, fp) __sputc(x, fp)
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif
# 508 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif /* __cplusplus */
# 509 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
__END_DECLS
__NULLABILITY_PRAGMA_POP
#endif /* !_STDIO_H_ */
# 514 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdio.h" 3 4
# 82 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <stdlib.h>
#endif /* expanded by -frewrite-includes */
# 82 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdlib.h 8.5 (Berkeley) 5/19/95
* $FreeBSD$
*/
#ifndef _STDLIB_H_
#define _STDLIB_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
__NULLABILITY_PRAGMA_PUSH
#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef __rune_t rune_t;
#define _RUNE_T_DECLARED
#endif
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 53 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef __cplusplus
#ifndef _WCHAR_T_DECLARED
typedef ___wchar_t wchar_t;
#define _WCHAR_T_DECLARED
#endif
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
typedef struct {
int quot; /* quotient */
int rem; /* remainder */
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 0x7ffffffd
__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdlib.h>
#endif /* expanded by -frewrite-includes */
# 78 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 79 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 80 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
extern int __mb_cur_max;
extern int ___mb_cur_max(void);
#define MB_CUR_MAX ((size_t)___mb_cur_max())
_Noreturn void abort(void);
int abs(int) __pure2;
int atexit(void (* _Nonnull)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
void *bsearch(const void *, const void *, size_t,
size_t, int (*)(const void * _Nonnull, const void *));
void *calloc(size_t, size_t) __malloc_like __result_use_check
__alloc_size(1) __alloc_size(2);
div_t div(int, int) __pure2;
_Noreturn void exit(int);
void free(void *);
char *getenv(const char *);
long labs(long) __pure2;
ldiv_t ldiv(long, long) __pure2;
void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1);
int mblen(const char *, size_t);
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
void qsort(void *, size_t, size_t,
int (* _Nonnull)(const void *, const void *));
int rand(void);
void *realloc(void *, size_t) __result_use_check __alloc_size(2);
void srand(unsigned);
double strtod(const char * __restrict, char ** __restrict);
float strtof(const char * __restrict, char ** __restrict);
long strtol(const char * __restrict, char ** __restrict, int);
long double
strtold(const char * __restrict, char ** __restrict);
unsigned long
strtoul(const char * __restrict, char ** __restrict, int);
int system(const char *);
int wctomb(char *, wchar_t);
size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
/*
* Functions added in C99 which we make conditionally available in the
* BSD^C89 namespace if the compiler supports `long long'.
* The #if test is more complicated than it ought to be because
* __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
* is not supported in the compilation environment (which therefore means
* that it can't really be ISO C99).
*
* (The only other extension made by C99 in thie header is _Exit().)
*/
#if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus)
#ifdef __LONG_LONG_SUPPORTED
/* LONGLONG */
typedef struct {
long long quot;
long long rem;
} lldiv_t;
/* LONGLONG */
long long
atoll(const char *);
/* LONGLONG */
long long
llabs(long long) __pure2;
/* LONGLONG */
lldiv_t lldiv(long long, long long) __pure2;
/* LONGLONG */
long long
strtoll(const char * __restrict, char ** __restrict, int);
/* LONGLONG */
unsigned long long
strtoull(const char * __restrict, char ** __restrict, int);
#endif /* __LONG_LONG_SUPPORTED */
# 153 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
_Noreturn void _Exit(int);
#endif /* __ISO_C_VISIBLE >= 1999 */
# 156 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* If we're in a mode greater than C99, expose C11 functions.
*/
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
__alloc_size(2);
int at_quick_exit(void (*)(void));
_Noreturn void
quick_exit(int);
#endif /* __ISO_C_VISIBLE >= 2011 */
# 167 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* Extensions made by POSIX relative to C.
*/
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
char *realpath(const char * __restrict, char * __restrict);
#endif
# 173 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 199506
int rand_r(unsigned *); /* (TSF) */
#endif
# 176 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 200112
int posix_memalign(void **, size_t, size_t); /* (ADV) */
int setenv(const char *, const char *, int);
int unsetenv(const char *);
#endif
# 181 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
int getsubopt(char **, char *const *, char **);
#ifndef _MKDTEMP_DECLARED
char *mkdtemp(char *);
#define _MKDTEMP_DECLARED
#endif
# 188 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef _MKSTEMP_DECLARED
int mkstemp(char *);
#define _MKSTEMP_DECLARED
#endif
# 192 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
# 193 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* The only changes to the XSI namespace in revision 6 were the deletion
* of the ttyslot() and valloc() functions, which FreeBSD never declared
* in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which
* FreeBSD also does not have, and mktemp(), are to be deleted.
*/
#if __XSI_VISIBLE
/* XXX XSI requires pollution from <sys/wait.h> here. We'd rather not. */
long a64l(const char *);
double drand48(void);
/* char *ecvt(double, int, int * __restrict, int * __restrict); */
double erand48(unsigned short[3]);
/* char *fcvt(double, int, int * __restrict, int * __restrict); */
/* char *gcvt(double, int, int * __restrict, int * __restrict); */
int grantpt(int);
char *initstate(unsigned int, char *, size_t);
long jrand48(unsigned short[3]);
char *l64a(long);
void lcong48(unsigned short[7]);
long lrand48(void);
#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)
char *mktemp(char *);
#define _MKTEMP_DECLARED
#endif
# 218 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
long mrand48(void);
long nrand48(unsigned short[3]);
int posix_openpt(int);
char *ptsname(int);
int putenv(char *);
long random(void);
unsigned short
*seed48(unsigned short[3]);
char *setstate(/* const */ char *);
void srand48(long);
void srandom(unsigned int);
int unlockpt(int);
#endif /* __XSI_VISIBLE */
# 231 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __BSD_VISIBLE
extern const char *malloc_conf;
extern void (*malloc_message)(void *, const char *);
/*
* The alloca() function can't be implemented in C, and on some
* platforms it can't be implemented at all as a callable function.
* The GNU C compiler provides a built-in alloca() which we can use;
* in all other cases, provide a prototype, mainly to pacify various
* incarnations of lint. On platforms where alloca() is not in libc,
* programs which use it will fail to link when compiled with non-GNU
* compilers.
*/
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#undef alloca /* some GNU bits try to get cute and define this on their own */
#define alloca(sz) __builtin_alloca(sz)
#elif defined(lint)
# 249 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
void *alloca(size_t);
#endif
# 251 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
void abort2(const char *, int, void **) __dead2;
__uint32_t
arc4random(void);
void arc4random_addrandom(unsigned char *, int);
void arc4random_buf(void *, size_t);
void arc4random_stir(void);
__uint32_t
arc4random_uniform(__uint32_t);
#ifdef __BLOCKS__
int atexit_b(void (^ _Nonnull)(void));
void *bsearch_b(const void *, const void *, size_t,
size_t, int (^ _Nonnull)(const void *, const void *));
#endif
# 265 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
char *getbsize(int *, long *);
/* getcap(3) functions */
char *cgetcap(char *, const char *, int);
int cgetclose(void);
int cgetent(char **, char **, const char *);
int cgetfirst(char **, char **);
int cgetmatch(const char *, const char *);
int cgetnext(char **, char **);
int cgetnum(char *, const char *, long *);
int cgetset(const char *);
int cgetstr(char *, const char *, char **);
int cgetustr(char *, const char *, char **);
int daemon(int, int);
char *devname(__dev_t, __mode_t);
char *devname_r(__dev_t, __mode_t, char *, int);
char *fdevname(int);
char *fdevname_r(int, char *, int);
int getloadavg(double [], int);
const char *
getprogname(void);
int heapsort(void *, size_t, size_t,
int (* _Nonnull)(const void *, const void *));
#ifdef __BLOCKS__
int heapsort_b(void *, size_t, size_t,
int (^ _Nonnull)(const void *, const void *));
void qsort_b(void *, size_t, size_t,
int (^ _Nonnull)(const void *, const void *));
#endif
# 295 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
int l64a_r(long, char *, int);
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
#ifdef __BLOCKS__
int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
#endif
# 300 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
int mkostemp(char *, int);
int mkostemps(char *, int, int);
void qsort_r(void *, size_t, size_t, void *,
int (*)(void *, const void *, const void *));
int radixsort(const unsigned char **, int, const unsigned char *,
unsigned);
void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
__alloc_size(3);
void *reallocf(void *, size_t) __alloc_size(2);
int rpmatch(const char *);
void setprogname(const char *);
int sradixsort(const unsigned char **, int, const unsigned char *,
unsigned);
void sranddev(void);
void srandomdev(void);
long long
strtonum(const char *, long long, long long, const char **);
/* Deprecated interfaces, to be removed. */
__int64_t
strtoq(const char *, char **, int);
__uint64_t
strtouq(const char *, char **, int);
#if __has_feature(capabilities)
long strtol_c(__capability const char * __restrict,
char * __capability * __capability __restrict, int);
long double
strtold_c(__capability const char * __restrict,
char * __capability * __restrict);
#endif
# 331 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
int timsort(void *base, size_t nel, size_t width,
int (*compar) (const void *, const void *));
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* __BSD_VISIBLE */
# 337 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
__END_DECLS
__NULLABILITY_PRAGMA_POP
#endif /* !_STDLIB_H_ */
# 341 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 83 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <string.h>
#endif /* expanded by -frewrite-includes */
# 83 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)string.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _STRING_H_
#define _STRING_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
/*
* Prototype functions which were historically defined in <string.h>, but
* are required by POSIX to be prototyped in <strings.h>.
*/
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <strings.h>
#endif /* expanded by -frewrite-includes */
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _STRINGS_H_
#define _STRINGS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 32 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
# 34 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
__BEGIN_DECLS
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */
void bcopy(const void *, void *, size_t); /* LEGACY */
void bzero(void *, size_t); /* LEGACY */
#endif
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE
void explicit_bzero(void *, size_t);
#endif
# 49 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#if __XSI_VISIBLE
int ffs(int) __pure2;
#endif
# 52 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE
int ffsl(long) __pure2;
int ffsll(long long) __pure2;
int fls(int) __pure2;
int flsl(long) __pure2;
int flsll(long long) __pure2;
#endif
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
char *index(const char *, int) __pure; /* LEGACY */
char *rindex(const char *, int) __pure; /* LEGACY */
#endif
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
int strcasecmp(const char *, const char *) __pure;
int strncasecmp(const char *, const char *, size_t) __pure;
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_strings.h>
#endif /* expanded by -frewrite-includes */
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_strings.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_strings.h" 3 4
/*
* This file is included from both strings.h and xlocale.h. We need to expose
* the declarations unconditionally if we are included from xlocale.h, but only
* if we are in POSIX2008 mode if included from string.h.
*/
#ifndef _XLOCALE_STRINGS1_H
#define _XLOCALE_STRINGS1_H
/*
* POSIX2008 functions
*/
int strcasecmp_l(const char *, const char *, locale_t);
int strncasecmp_l(const char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRINGS1_H */
# 49 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_strings.h" 3 4
# 68 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 2 3 4
#endif
# 69 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
__END_DECLS
#endif /* _STRINGS_H_ */
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/strings.h" 3 4
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 2 3 4
#endif
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 52 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
__BEGIN_DECLS
#if __XSI_VISIBLE >= 600
void *memccpy(void * __restrict, const void * __restrict, int, size_t);
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
void *memchr(const void *, int, size_t) __pure;
#if __BSD_VISIBLE
void *memrchr(const void *, int, size_t) __pure;
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
int memcmp(const void *, const void *, size_t) __pure;
void *memcpy(void * __restrict, const void * __restrict, size_t);
#if __BSD_VISIBLE
void *memmem(const void *, size_t, const void *, size_t) __pure;
#endif
# 66 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
void *memmove(void *, const void *, size_t);
void *memset(void *, int, size_t);
#if __POSIX_VISIBLE >= 200809
char *stpcpy(char * __restrict, const char * __restrict);
char *stpncpy(char * __restrict, const char * __restrict, size_t);
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char *strcasestr(const char *, const char *) __pure;
#endif
# 75 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
char *strcat(char * __restrict, const char * __restrict);
char *strchr(const char *, int) __pure;
#if __BSD_VISIBLE
char *strchrnul(const char*, int) __pure;
#endif
# 80 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
int strcmp(const char *, const char *) __pure;
int strcoll(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char *, const char *) __pure;
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
char *strdup(const char *) __malloc_like;
#endif
# 87 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
char *strerror(int);
#if __POSIX_VISIBLE >= 200112
int strerror_r(int, char *, size_t);
#endif
# 91 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
size_t strlcat(char * __restrict, const char * __restrict, size_t);
size_t strlcpy(char * __restrict, const char * __restrict, size_t);
#endif
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
size_t strlen(const char *) __pure;
#if __BSD_VISIBLE
void strmode(int, char *);
#endif
# 99 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
char *strncat(char * __restrict, const char * __restrict, size_t);
int strncmp(const char *, const char *, size_t) __pure;
char *strncpy(char * __restrict, const char * __restrict, size_t);
#if __POSIX_VISIBLE >= 200809
char *strndup(const char *, size_t) __malloc_like;
size_t strnlen(const char *, size_t) __pure;
#endif
# 106 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char *strnstr(const char *, const char *, size_t) __pure;
#endif
# 109 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
char *strpbrk(const char *, const char *) __pure;
char *strrchr(const char *, int) __pure;
#if __BSD_VISIBLE
char *strsep(char **, const char *);
#endif
# 114 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __POSIX_VISIBLE >= 200809
char *strsignal(int);
#endif
# 117 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
size_t strspn(const char *, const char *) __pure;
char *strstr(const char *, const char *) __pure;
char *strtok(char * __restrict, const char * __restrict);
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
char *strtok_r(char *, const char *, char **);
#endif
# 123 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
size_t strxfrm(char * __restrict, const char * __restrict, size_t);
#if __BSD_VISIBLE
#ifndef _SWAB_DECLARED
#define _SWAB_DECLARED
#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif /* _SIZE_T_DECLARED */
# 133 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
void swab(const void * __restrict, void * __restrict, ssize_t);
#endif /* _SWAB_DECLARED */
# 136 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __has_feature(capabilities)
__capability const void *
memchr_c_const(__capability const void *, int, size_t) __pure;
__capability void
*memchr_c(__capability const void *, int, size_t) __pure;
int memcmp_c(__capability const void *, __capability const void *, size_t)
__pure;
__capability void
*memcpy_c(__capability void * __restrict,
__capability const void * __restrict, size_t);
void *memcpy_c_fromcap(void * __restrict,
__capability const void * __restrict, size_t);
__capability void
*memcpy_c_tocap(__capability void * __restrict,
const void * __restrict, size_t);
__capability void
*memmove_c(__capability void * __restrict,
__capability const void * __restrict, size_t);
__capability void
*memset_c(__capability void *, int, size_t);
__capability char
*strchr_c(__capability const char *, int) __pure;
int strcmp_c(__capability const char *,
__capability const char *s2) __pure;
__capability char
*strcpy_c(__capability char * __restrict,
__capability const char * __restrict);
int strncmp_c(__capability const char *, __capability const char *,
size_t) __pure;
__capability char
*strncpy_c(__capability char * __restrict, __capability const char * __restrict,
size_t);
char *strncpy_c_fromcap(char * __restrict,
__capability const char * __restrict, size_t);
__capability char
*strncpy_c_tocap(__capability char * __restrict,
const char * __restrict, size_t);
size_t strnlen_c(__capability const char *, size_t) __pure;
#endif
# 177 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
int timingsafe_bcmp(const void *, const void *, size_t);
int timingsafe_memcmp(const void *, const void *, size_t);
#endif /* __BSD_VISIBLE */
# 181 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_string.h>
#endif /* expanded by -frewrite-includes */
# 183 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_string.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
/*
* This file is included from both string.h and xlocale.h. We need to expose
* the declarations unconditionally if we are included from xlocale.h, but only
* if we are in POSIX2008 mode if included from string.h.
*/
#ifndef _XLOCALE_STRING1_H
#define _XLOCALE_STRING1_H
/*
* POSIX2008 functions
*/
int strcoll_l(const char *, const char *, locale_t);
size_t strxfrm_l(char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRING1_H */
# 49 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
/*
* xlocale extensions
*/
#ifdef _XLOCALE_H_
#ifndef _XLOCALE_STRING2_H
#define _XLOCALE_STRING2_H
char *strcasestr_l(const char *, const char *, locale_t);
#endif /* _XLOCALE_STRING2_H */
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
#endif /* _XLOCALE_H_ */
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
# 184 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 2 3 4
#endif
# 185 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
__END_DECLS
#endif /* _STRING_H_ */
# 188 "/home/en322/cheri/output/sdk256/sysroot/usr/include/string.h" 3 4
# 84 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <stddef.h>
#endif /* expanded by -frewrite-includes */
# 84 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stddef.h 8.1 (Berkeley) 6/2/93
*
* $FreeBSD$
*/
#ifndef _STDDEF_H_
#define _STDDEF_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#ifndef _PTRDIFF_T_DECLARED
typedef __ptrdiff_t ptrdiff_t;
#define _PTRDIFF_T_DECLARED
#endif
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef __rune_t rune_t;
#define _RUNE_T_DECLARED
#endif
# 51 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#endif
# 52 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#ifndef __cplusplus
#ifndef _WCHAR_T_DECLARED
typedef ___wchar_t wchar_t;
#define _WCHAR_T_DECLARED
#endif
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#endif
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
#ifndef __CLANG_MAX_ALIGN_T_DEFINED
typedef __max_align_t max_align_t;
#define __CLANG_MAX_ALIGN_T_DEFINED
#define _GCC_MAX_ALIGN_T
#endif
# 71 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
#define offsetof(type, member) __offsetof(type, member)
#endif /* _STDDEF_H_ */
# 76 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stddef.h" 3 4
# 85 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <stdarg.h>
#endif /* expanded by -frewrite-includes */
# 85 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 1 3 4
/*
* JNPR: stdarg.h,v 1.3 2006/09/15 12:52:34 katta
* $FreeBSD$
*/
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 8 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
# 9 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 9 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
# 10 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#if __GNUC__ >= 3
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
# 18 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#define va_start(v,l) __builtin_va_start((v),l)
#define va_end __builtin_va_end
#define va_arg __builtin_va_arg
#define va_copy __builtin_va_copy
#else /* __GNUC__ */
# 24 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* ---------------------------------------- */
/* VARARGS for MIPS/GNU CC */
/* ---------------------------------------- */
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 30 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
# 31 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* These macros implement varargs for GNU C--either traditional or ANSI. */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef char * __gnuc_va_list;
typedef __gnuc_va_list va_list;
#endif /* ! __GNUC_VA_LIST */
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#ifndef _VA_MIPS_H_ENUM
#define _VA_MIPS_H_ENUM
enum {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* In GCC version 2, we want an ellipsis at the end of the declaration
of the argument list. GCC version 1 can't parse it. */
#if __GNUC__ > 1
#define __va_ellipsis ...
#else
# 79 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#define __va_ellipsis
#endif
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#define va_start(__AP, __LASTARG) \
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
#define va_end(__AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
/* The __mips64 cases are reversed from the 32 bit cases, because the standard
32 bit calling convention left-aligns all parameters smaller than a word,
whereas the __mips64 calling convention does not (and hence they are
right aligned). */
#ifdef __mips64
#define __va_rounded_size(__TYPE) (((sizeof (__TYPE) + 8 - 1) / 8) * 8)
#define __va_reg_size 8
#if defined(__MIPSEB__) || (BYTE_ORDER == BIG_ENDIAN)
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) \
((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))))[-1]
#else /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
# 108 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#define va_arg(__AP, __type) \
((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#endif /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
# 113 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#else /* ! __mips64 */
# 115 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#define __va_rounded_size(__TYPE) \
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define __va_reg_size 4
#if defined(__MIPSEB__) || (BYTE_ORDER == BIG_ENDIAN)
/* For big-endian machines. */
#define va_arg(__AP, __type) \
((__AP = (char *) ((__alignof__ (__type) > 4 \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#else /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
# 130 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* For little-endian machines. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
# 137 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#endif /* ! __mips64 */
# 138 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#define va_copy(dest, src) (dest) = (src)
#endif /* __GNUC__ */
# 144 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
#endif /* _MACHINE_STDARG_H_ */
# 145 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdarg.h" 3 4
# 86 "../../../../src/include/c.h" 2
#ifdef HAVE_STRINGS_H
#if 0 /* expanded by -frewrite-includes */
#include <strings.h>
#endif /* expanded by -frewrite-includes */
# 87 "../../../../src/include/c.h"
# 88 "../../../../src/include/c.h"
#endif
# 89 "../../../../src/include/c.h"
#ifdef HAVE_STDINT_H
#if 0 /* expanded by -frewrite-includes */
#include <stdint.h>
#endif /* expanded by -frewrite-includes */
# 90 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 1 3 4
/*-
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_STDINT_H_
#define _SYS_STDINT_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 32 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
# 34 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_stdint.h>
#endif /* expanded by -frewrite-includes */
# 35 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 1 3 4
/*-
* Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* from: src/sys/i386/include/_stdint.h,v 1.2 2004/05/18 16:04:57 stefanf
* $FreeBSD$
*/
#ifndef _MACHINE__STDINT_H_
#define _MACHINE__STDINT_H_
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
#define INT8_C(c) (c)
#define INT16_C(c) (c)
#define INT32_C(c) (c)
#define UINT8_C(c) (c)
#define UINT16_C(c) (c)
#define UINT32_C(c) (c ## U)
#ifdef __mips_n64
#define INT64_C(c) (c ## L)
#define UINT64_C(c) (c ## UL)
#else
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#define INTMAX_C(c) INT64_C(c)
#define UINTMAX_C(c) UINT64_C(c)
#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
# 66 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
#ifndef __INT64_C
#ifdef __mips_n64
#define __INT64_C(c) (c ## L)
#define __UINT64_C(c) (c ## UL)
#else
# 74 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#define __INT64_C(c) (c ## LL)
#define __UINT64_C(c) (c ## ULL)
#endif
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#endif
# 78 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
/*
* ISO/IEC 9899:1999
* 7.18.2.1 Limits of exact-width integer types
*/
/* Minimum values of exact-width signed integer types. */
#define INT8_MIN (-0x7f-1)
#define INT16_MIN (-0x7fff-1)
#define INT32_MIN (-0x7fffffff-1)
#define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1)
/* Maximum values of exact-width signed integer types. */
#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff
#define INT64_MAX __INT64_C(0x7fffffffffffffff)
/* Maximum values of exact-width unsigned integer types. */
#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffff
#define UINT64_MAX __UINT64_C(0xffffffffffffffff)
/*
* ISO/IEC 9899:1999
* 7.18.2.2 Limits of minimum-width integer types
*/
/* Minimum values of minimum-width signed integer types. */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
/* Maximum values of minimum-width signed integer types. */
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
/* Maximum values of minimum-width unsigned integer types. */
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.2.3 Limits of fastest minimum-width integer types
*/
/* Minimum values of fastest minimum-width signed integer types. */
#define INT_FAST8_MIN INT32_MIN
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
/* Maximum values of fastest minimum-width signed integer types. */
#define INT_FAST8_MAX INT32_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
/* Maximum values of fastest minimum-width unsigned integer types. */
#define UINT_FAST8_MAX UINT32_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.2.4 Limits of integer types capable of holding object pointers
*/
#ifdef __mips_n64
#define INTPTR_MIN INT64_MIN
#define INTPTR_MAX INT64_MAX
#define UINTPTR_MAX UINT64_MAX
#else
# 154 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#endif
# 158 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
/*
* ISO/IEC 9899:1999
* 7.18.2.5 Limits of greatest-width integer types
*/
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.3 Limits of other integer types
*/
#ifdef __mips_n64
/* Limits of ptrdiff_t. */
#define PTRDIFF_MIN INT64_MIN
#define PTRDIFF_MAX INT64_MAX
/* Limit of size_t. */
#define SIZE_MAX UINT64_MAX
#else
# 179 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
/* Limits of ptrdiff_t. */
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
/* Limit of size_t. */
#define SIZE_MAX UINT32_MAX
#endif
# 186 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
/* Limits of sig_atomic_t. */
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
/* Limits of wint_t. */
#define WINT_MIN INT32_MIN
#define WINT_MAX INT32_MAX
#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
# 196 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
#endif /* !_MACHINE__STDINT_H_ */
# 198 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_stdint.h" 3 4
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_stdint.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 1 3 4
/*-
* Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__STDINT_H_
#define _SYS__STDINT_H_
#ifndef _INT8_T_DECLARED
typedef __int8_t int8_t;
#define _INT8_T_DECLARED
#endif
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT16_T_DECLARED
typedef __int16_t int16_t;
#define _INT16_T_DECLARED
#endif
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT32_T_DECLARED
typedef __int32_t int32_t;
#define _INT32_T_DECLARED
#endif
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT64_T_DECLARED
typedef __int64_t int64_t;
#define _INT64_T_DECLARED
#endif
# 52 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT8_T_DECLARED
typedef __uint8_t uint8_t;
#define _UINT8_T_DECLARED
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT16_T_DECLARED
typedef __uint16_t uint16_t;
#define _UINT16_T_DECLARED
#endif
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT64_T_DECLARED
typedef __uint64_t uint64_t;
#define _UINT64_T_DECLARED
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INTPTR_T_DECLARED
typedef __intptr_t intptr_t;
#define _INTPTR_T_DECLARED
#endif
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINTPTR_T_DECLARED
typedef __uintptr_t uintptr_t;
#define _UINTPTR_T_DECLARED
#endif
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INTMAX_T_DECLARED
typedef __intmax_t intmax_t;
#define _INTMAX_T_DECLARED
#endif
# 85 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINTMAX_T_DECLARED
typedef __uintmax_t uintmax_t;
#define _UINTMAX_T_DECLARED
#endif
# 89 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _VADDR_T_DECLARED
#ifndef __CHERI_PURE_CAPABILITY__
typedef __uintptr_t vaddr_t;
#else
# 94 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
typedef __uint64_t vaddr_t;
#endif
# 96 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#define _VADDR_T_DECLARED
#endif
# 98 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#endif /* !_SYS__STDINT_H_ */
# 100 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 2 3 4
typedef __int_least8_t int_least8_t;
typedef __int_least16_t int_least16_t;
typedef __int_least32_t int_least32_t;
typedef __int_least64_t int_least64_t;
typedef __uint_least8_t uint_least8_t;
typedef __uint_least16_t uint_least16_t;
typedef __uint_least32_t uint_least32_t;
typedef __uint_least64_t uint_least64_t;
typedef __int_fast8_t int_fast8_t;
typedef __int_fast16_t int_fast16_t;
typedef __int_fast32_t int_fast32_t;
typedef __int_fast64_t int_fast64_t;
typedef __uint_fast8_t uint_fast8_t;
typedef __uint_fast16_t uint_fast16_t;
typedef __uint_fast32_t uint_fast32_t;
typedef __uint_fast64_t uint_fast64_t;
/* GNU and Darwin define this and people seem to think it's portable */
#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
#define __WORDSIZE 64
#else
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
#define __WORDSIZE 32
#endif
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
/* Limits of wchar_t. */
#define WCHAR_MIN __WCHAR_MIN
#define WCHAR_MAX __WCHAR_MAX
#endif /* !_SYS_STDINT_H_ */
# 70 "/home/en322/cheri/output/sdk256/sysroot/usr/include/stdint.h" 3 4
# 91 "../../../../src/include/c.h" 2
#endif
# 92 "../../../../src/include/c.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 92 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.6 (Berkeley) 2/19/95
* $FreeBSD$
*/
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
/* Machine type dependent parameters. */
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 1 3 4
/*-
* Copyright (c) 1987, 1991 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 7.8 (Berkeley) 4/3/91
* $FreeBSD$
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifndef __ASSEMBLER__
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifdef __cplusplus
extern "C" {
#endif
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#ifdef __MIPSEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
# 56 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif /* __MIBSEB__ */
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
/*
* Deprecated variants that don't have enough underscores to be useful in more
* strict namespaces.
*/
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
# 69 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifndef __ASSEMBLER__
#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
#define __is_constant(x) __builtin_constant_p(x)
#else
# 74 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define __is_constant(x) 0
#endif
# 76 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define __bswap16_const(x) (((x) >> 8) | (((x) << 8) & 0xff00))
#define __bswap32_const(x) (((x) >> 24) | (((x) >> 8) & 0xff00) | \
(((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000))
#define __bswap64_const(x) (((x) >> 56) | (((x) >> 40) & 0xff00) | \
(((x) >> 24) & 0xff0000) | (((x) >> 8) & 0xff000000) | \
(((x) << 8) & ((__uint64_t)0xff << 32)) | \
(((x) << 24) & ((__uint64_t)0xff << 40)) | \
(((x) << 40) & ((__uint64_t)0xff << 48)) | (((x) << 56)))
static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{
return ((_x >> 8) | ((_x << 8) & 0xff00));
}
static __inline __uint32_t
__bswap32_var(__uint32_t _x)
{
return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) |
((_x << 24) & 0xff000000));
}
static __inline __uint64_t
__bswap64_var(__uint64_t _x)
{
return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
((_x << 24) & ((__uint64_t)0xff << 40)) |
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
#define __bswap16(x) ((__uint16_t)(__is_constant((x)) ? \
__bswap16_const((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))))
#define __bswap32(x) ((__uint32_t)(__is_constant((x)) ? \
__bswap32_const((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x))))
#define __bswap64(x) ((__uint64_t)(__is_constant((x)) ? \
__bswap64_const((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x))))
#ifdef __MIPSEB__
#define __htonl(x) ((__uint32_t)(x))
#define __htons(x) ((__uint16_t)(x))
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
/*
* Define the order of 32-bit words in 64-bit words.
*/
/*
* XXXMIPS: Additional parentheses to make gcc more happy.
*/
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#else
# 132 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#define __ntohl(x) (__bswap32((x)))
#define __ntohs(x) (__bswap16((x)))
#define __htonl(x) (__bswap32((x)))
#define __htons(x) (__bswap16((x)))
#endif /* _MIPSEB */
# 139 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif /* _ASSEMBLER_ */
# 141 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifdef __cplusplus
}
#endif
# 145 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif /* !_MACHINE_ENDIAN_H_ */
# 147 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_pthreadtypes.h>
#endif /* expanded by -frewrite-includes */
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 1 3 4
/*
* Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
* Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Chris Provenzano.
* 4. The name of Chris Provenzano may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__PTHREADTYPES_H_
#define _SYS__PTHREADTYPES_H_
/*
* Forward structure definitions.
*
* These are mostly opaque to the user.
*/
struct pthread;
struct pthread_attr;
struct pthread_cond;
struct pthread_cond_attr;
struct pthread_mutex;
struct pthread_mutex_attr;
struct pthread_once;
struct pthread_rwlock;
struct pthread_rwlockattr;
struct pthread_barrier;
struct pthread_barrier_attr;
struct pthread_spinlock;
/*
* Primitive system data type definitions required by P1003.1c.
*
* Note that P1003.1c specifies that there are no defined comparison
* or assignment operators for the types pthread_attr_t, pthread_cond_t,
* pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
*/
#ifndef _PTHREAD_T_DECLARED
typedef struct pthread *pthread_t;
#define _PTHREAD_T_DECLARED
#endif
# 68 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 3 4
typedef struct pthread_attr *pthread_attr_t;
typedef struct pthread_mutex *pthread_mutex_t;
typedef struct pthread_mutex_attr *pthread_mutexattr_t;
typedef struct pthread_cond *pthread_cond_t;
typedef struct pthread_cond_attr *pthread_condattr_t;
typedef int pthread_key_t;
typedef struct pthread_once pthread_once_t;
typedef struct pthread_rwlock *pthread_rwlock_t;
typedef struct pthread_rwlockattr *pthread_rwlockattr_t;
typedef struct pthread_barrier *pthread_barrier_t;
typedef struct pthread_barrierattr *pthread_barrierattr_t;
typedef struct pthread_spinlock *pthread_spinlock_t;
/*
* Additional type definitions:
*
* Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
* use in header symbols.
*/
typedef void *pthread_addr_t;
typedef void *(*pthread_startroutine_t)(void *);
/*
* Once definitions.
*/
struct pthread_once {
int state;
pthread_mutex_t mutex;
};
#endif /* ! _SYS__PTHREADTYPES_H_ */
# 99 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 3 4
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
#if __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#ifndef _KERNEL
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
#endif
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/_stdint.h>
#endif /* expanded by -frewrite-includes */
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
typedef __uint64_t u_quad_t; /* quads (deprecated) */
typedef __int64_t quad_t;
typedef quad_t * qaddr_t;
typedef char * caddr_t; /* core address */
typedef const char * c_caddr_t; /* core address, pointer to const */
#ifndef _BLKSIZE_T_DECLARED
typedef __blksize_t blksize_t;
#define _BLKSIZE_T_DECLARED
#endif
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __cpuwhich_t cpuwhich_t;
typedef __cpulevel_t cpulevel_t;
typedef __cpusetid_t cpusetid_t;
#ifndef _BLKCNT_T_DECLARED
typedef __blkcnt_t blkcnt_t;
#define _BLKCNT_T_DECLARED
#endif
# 90 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED
#endif
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CLOCKID_T_DECLARED
typedef __clockid_t clockid_t;
#define _CLOCKID_T_DECLARED
#endif
# 100 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __critical_t critical_t; /* Critical section value */
typedef __int64_t daddr_t; /* disk address */
#ifndef _DEV_T_DECLARED
typedef __dev_t dev_t; /* device number or struct cdev */
#define _DEV_T_DECLARED
#endif
# 108 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _FFLAGS_T_DECLARED
typedef __fflags_t fflags_t; /* file flags */
#define _FFLAGS_T_DECLARED
#endif
# 113 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __fixpt_t fixpt_t; /* fixed point number */
#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
#define _FSBLKCNT_T_DECLARED
#endif
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _GID_T_DECLARED
typedef __gid_t gid_t; /* group id */
#define _GID_T_DECLARED
#endif
# 126 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _IN_ADDR_T_DECLARED
typedef __uint32_t in_addr_t; /* base type for internet address */
#define _IN_ADDR_T_DECLARED
#endif
# 131 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _IN_PORT_T_DECLARED
typedef __uint16_t in_port_t;
#define _IN_PORT_T_DECLARED
#endif
# 136 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _ID_T_DECLARED
typedef __id_t id_t; /* can hold a uid_t or pid_t */
#define _ID_T_DECLARED
#endif
# 141 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _INO_T_DECLARED
typedef __ino_t ino_t; /* inode number */
#define _INO_T_DECLARED
#endif
# 146 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _KEY_T_DECLARED
typedef __key_t key_t; /* IPC key (for Sys V IPC) */
#define _KEY_T_DECLARED
#endif
# 151 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _LWPID_T_DECLARED
typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */
#define _LWPID_T_DECLARED
#endif
# 156 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MODE_T_DECLARED
typedef __mode_t mode_t; /* permissions */
#define _MODE_T_DECLARED
#endif
# 161 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _ACCMODE_T_DECLARED
typedef __accmode_t accmode_t; /* access permissions */
#define _ACCMODE_T_DECLARED
#endif
# 166 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _NLINK_T_DECLARED
typedef __nlink_t nlink_t; /* link count */
#define _NLINK_T_DECLARED
#endif
# 171 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _OFF_T_DECLARED
typedef __off_t off_t; /* file offset */
#define _OFF_T_DECLARED
#endif
# 176 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _OFF64_T_DECLARED
typedef __off64_t off64_t; /* file offset (alias) */
#define _OFF64_T_DECLARED
#endif
# 181 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t; /* process id */
#define _PID_T_DECLARED
#endif
# 186 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __register_t register_t;
#ifndef _RLIM_T_DECLARED
typedef __rlim_t rlim_t; /* resource limit */
#define _RLIM_T_DECLARED
#endif
# 193 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __int64_t sbintime_t;
typedef __segsz_t segsz_t; /* segment size (in pages) */
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 202 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif
# 207 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _SUSECONDS_T_DECLARED
typedef __suseconds_t suseconds_t; /* microseconds (signed) */
#define _SUSECONDS_T_DECLARED
#endif
# 212 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 217 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TIMER_T_DECLARED
typedef __timer_t timer_t;
#define _TIMER_T_DECLARED
#endif
# 222 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MQD_T_DECLARED
typedef __mqd_t mqd_t;
#define _MQD_T_DECLARED
#endif
# 227 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __u_register_t u_register_t;
#ifndef _UID_T_DECLARED
typedef __uid_t uid_t; /* user id */
#define _UID_T_DECLARED
#endif
# 234 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _USECONDS_T_DECLARED
typedef __useconds_t useconds_t; /* microseconds (unsigned) */
#define _USECONDS_T_DECLARED
#endif
# 239 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CAP_IOCTL_T_DECLARED
#define _CAP_IOCTL_T_DECLARED
typedef unsigned long cap_ioctl_t;
#endif
# 244 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CAP_RIGHTS_T_DECLARED
#define _CAP_RIGHTS_T_DECLARED
struct cap_rights;
typedef struct cap_rights cap_rights_t;
#endif
# 251 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __vm_offset_t vm_offset_t;
typedef __int64_t vm_ooffset_t;
typedef __vm_paddr_t vm_paddr_t;
typedef __uint64_t vm_pindex_t;
typedef __vm_size_t vm_size_t;
typedef __rman_res_t rman_res_t;
#ifdef _KERNEL
typedef int boolean_t;
typedef struct device *device_t;
typedef __intfptr_t intfptr_t;
/*
* XXX this is fixed width for historical reasons. It should have had type
* __int_fast32_t. Fixed-width types should not be used unless binary
* compatibility is essential. Least-width types should be used even less
* since they provide smaller benefits.
*
* XXX should be MD.
*
* XXX this is bogus in -current, but still used for spl*().
*/
typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */
typedef __uintfptr_t uintfptr_t;
typedef __uint64_t uoff_t;
typedef char vm_memattr_t; /* memory attribute codes */
typedef struct vm_page *vm_page_t;
#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
#define __bool_true_false_are_defined 1
#define false 0
#define true 1
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
typedef int _Bool;
#endif
# 289 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef _Bool bool;
#endif /* !__bool_true_false_are_defined && !__cplusplus */
# 291 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#define offsetof(type, field) __offsetof(type, field)
#endif /* !_KERNEL */
# 295 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* The following are all things that really shouldn't exist in this header,
* since its purpose is to provide typedefs, not miscellaneous doodads.
*/
#ifdef __POPCNT__
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
#define __bitcount16(x) __builtin_popcount((__uint16_t)(x))
#define __bitcountl(x) __builtin_popcountl((unsigned long)(x))
#define __bitcount(x) __builtin_popcount((unsigned int)(x))
#else
# 308 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* Population count algorithm using SWAR approach
* - "SIMD Within A Register".
*/
static __inline __uint16_t
__bitcount16(__uint16_t _x)
{
_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f;
_x = (_x + (_x >> 8)) & 0x00ff;
return (_x);
}
static __inline __uint32_t
__bitcount32(__uint32_t _x)
{
_x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
_x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f0f0f;
_x = (_x + (_x >> 8));
_x = (_x + (_x >> 16)) & 0x000000ff;
return (_x);
}
#ifdef __LP64__
static __inline __uint64_t
__bitcount64(__uint64_t _x)
{
_x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
_x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
_x = (_x + (_x >> 8));
_x = (_x + (_x >> 16));
_x = (_x + (_x >> 32)) & 0x000000ff;
return (_x);
}
#define __bitcountl(x) __bitcount64((unsigned long)(x))
#else
# 351 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
static __inline __uint64_t
__bitcount64(__uint64_t _x)
{
return (__bitcount32(_x >> 32) + __bitcount32(_x));
}
#define __bitcountl(x) __bitcount32((unsigned long)(x))
#endif
# 360 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#define __bitcount(x) __bitcount32((unsigned int)(x))
#endif
# 362 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/select.h>
#endif /* expanded by -frewrite-includes */
# 365 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 1 3 4
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 35 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_sigset.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_sigset.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)signal.h 8.4 (Berkeley) 5/4/95
* $FreeBSD$
*/
#ifndef _SYS__SIGSET_H_
#define _SYS__SIGSET_H_
/*
* sigset_t macros.
*/
#define _SIG_WORDS 4
#define _SIG_MAXSIG 128
#define _SIG_IDX(sig) ((sig) - 1)
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
typedef struct __sigset {
__uint32_t __bits[_SIG_WORDS];
} __sigset_t;
#if defined(_KERNEL) && defined(COMPAT_43)
typedef unsigned int osigset_t;
#endif
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_sigset.h" 3 4
#endif /* !_SYS__SIGSET_H_ */
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_sigset.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timeval.h>
#endif /* expanded by -frewrite-includes */
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__TIMEVAL_H_
#define _SYS__TIMEVAL_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 32 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
# 33 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
#ifndef _SUSECONDS_T_DECLARED
typedef __suseconds_t suseconds_t;
#define _SUSECONDS_T_DECLARED
#endif
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
/*
* Structure returned by gettimeofday(2) system call, and used in other calls.
*/
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#endif /* !_SYS__TIMEVAL_H_ */
# 53 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
* $FreeBSD$
*/
#ifndef _SYS_TIMESPEC_H_
#define _SYS_TIMESPEC_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timespec.h>
#endif /* expanded by -frewrite-includes */
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timespec.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
* $FreeBSD$
*/
#ifndef _SYS__TIMESPEC_H_
#define _SYS__TIMESPEC_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif /* !_SYS__TIMESPEC_H_ */
# 50 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 2 3 4
#if __BSD_VISIBLE
#define TIMEVAL_TO_TIMESPEC(tv, ts) \
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
} while (0)
#define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
} while (0)
#endif /* __BSD_VISIBLE */
# 53 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
/*
* Structure defined by POSIX.1b to be like a itimerval, but with
* timespecs. Used in the timer_*() system calls.
*/
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
#endif /* _SYS_TIMESPEC_H_ */
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 2 3 4
typedef unsigned long __fd_mask;
#if __BSD_VISIBLE
typedef __fd_mask fd_mask;
#endif
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#ifndef _SIGSET_T_DECLARED
#define _SIGSET_T_DECLARED
typedef __sigset_t sigset_t;
#endif
# 51 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
/*
* Select uses bit masks of file descriptors in longs. These macros
* manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here should
* be enough for most uses.
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */
#if __BSD_VISIBLE
#define NFDBITS _NFDBITS
#endif
# 66 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#ifndef _howmany
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
# 70 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
typedef struct fd_set {
__fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
} fd_set;
#if __BSD_VISIBLE
#define fds_bits __fds_bits
#endif
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS))
#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
#if __BSD_VISIBLE
#define FD_COPY(f, t) (void)(*(t) = *(f))
#endif
# 83 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
#define FD_ZERO(p) do { \
fd_set *_p; \
__size_t _n; \
\
_p = (p); \
_n = _howmany(FD_SETSIZE, _NFDBITS); \
while (_n > 0) \
_p->__fds_bits[--_n] = 0; \
} while (0)
#ifndef _KERNEL
__BEGIN_DECLS
int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict,
const struct timespec *__restrict, const sigset_t *__restrict);
#ifndef _SELECT_DECLARED
#define _SELECT_DECLARED
/* XXX missing restrict type-qualifier */
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
# 105 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 107 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
#endif /* _SYS_SELECT_H_ */
# 109 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 366 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
/*
* minor() gives a cookie instead of an index since we don't want to
* change the meanings of bits 0-15 or waste time and space shifting
* bits 16-31 for devices that don't use them.
*/
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
/*
* These declarations belong elsewhere, but are repeated here and in
* <stdio.h> to give broken programs a better chance of working with
* 64-bit off_t's.
*/
#ifndef _KERNEL
__BEGIN_DECLS
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, off_t);
#endif
# 387 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _LSEEK_DECLARED
#define _LSEEK_DECLARED
off_t lseek(int, off_t, int);
#endif
# 391 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
void * mmap(void *, size_t, int, int, int, off_t);
#endif
# 395 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, off_t);
#endif
# 399 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 401 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif /* __BSD_VISIBLE */
# 403 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif /* !_SYS_TYPES_H_ */
# 405 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 93 "../../../../src/include/c.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <errno.h>
#endif /* expanded by -frewrite-includes */
# 94 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)errno.h 8.5 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _SYS_ERRNO_H_
#define _SYS_ERRNO_H_
#ifndef _KERNEL
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
__BEGIN_DECLS
int * __error(void);
__END_DECLS
#define errno (* __error())
#endif
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* Input/output error */
#define ENXIO 6 /* Device not configured */
#define E2BIG 7 /* Argument list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file descriptor */
#define ECHILD 10 /* No child processes */
#define EDEADLK 11 /* Resource deadlock avoided */
/* 11 was EAGAIN */
#define ENOMEM 12 /* Cannot allocate memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#ifndef _POSIX_SOURCE
#define ENOTBLK 15 /* Block device required */
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define EBUSY 16 /* Device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* Operation not supported by device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* Too many open files in system */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Inappropriate ioctl for device */
#ifndef _POSIX_SOURCE
#define ETXTBSY 26 /* Text file busy */
#endif
# 80 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only filesystem */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
/* math software */
#define EDOM 33 /* Numerical argument out of domain */
#define ERANGE 34 /* Result too large */
/* non-blocking and interrupt i/o */
#define EAGAIN 35 /* Resource temporarily unavailable */
#ifndef _POSIX_SOURCE
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
/* ipc/network software -- argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported */
#define ENOTSUP EOPNOTSUPP /* Operation not supported */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Operation timed out */
#define ECONNREFUSED 61 /* Connection refused */
#define ELOOP 62 /* Too many levels of symbolic links */
#endif /* _POSIX_SOURCE */
# 129 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define ENAMETOOLONG 63 /* File name too long */
/* should be rearranged */
#ifndef _POSIX_SOURCE
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#endif /* _POSIX_SOURCE */
# 136 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
#ifndef _POSIX_SOURCE
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
#define EBADRPC 72 /* RPC struct is bad */
#define ERPCMISMATCH 73 /* RPC version wrong */
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#define EPROGMISMATCH 75 /* Program version wrong */
#define EPROCUNAVAIL 76 /* Bad procedure for program */
#endif /* _POSIX_SOURCE */
# 153 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define ENOLCK 77 /* No locks available */
#define ENOSYS 78 /* Function not implemented */
#ifndef _POSIX_SOURCE
#define EFTYPE 79 /* Inappropriate file type or format */
#define EAUTH 80 /* Authentication error */
#define ENEEDAUTH 81 /* Need authenticator */
#define EIDRM 82 /* Identifier removed */
#define ENOMSG 83 /* No message of desired type */
#define EOVERFLOW 84 /* Value too large to be stored in data type */
#define ECANCELED 85 /* Operation canceled */
#define EILSEQ 86 /* Illegal byte sequence */
#define ENOATTR 87 /* Attribute not found */
#define EDOOFUS 88 /* Programming error */
#endif /* _POSIX_SOURCE */
# 170 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#define EBADMSG 89 /* Bad message */
#define EMULTIHOP 90 /* Multihop attempted */
#define ENOLINK 91 /* Link has been severed */
#define EPROTO 92 /* Protocol error */
#ifndef _POSIX_SOURCE
#define ENOTCAPABLE 93 /* Capabilities insufficient */
#define ECAPMODE 94 /* Not permitted in capability mode */
#define ENOTRECOVERABLE 95 /* State not recoverable */
#define EOWNERDEAD 96 /* Previous owner died */
#define EPROT 97 /* Memory protection violation */
#define ENOMETHOD 98 /* Undefined object-capability method */
#endif /* _POSIX_SOURCE */
# 184 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#ifndef _POSIX_SOURCE
#define ELAST 98 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
# 188 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
/* pseudo-errors returned inside kernel to modify return to process */
#define ERESTART (-1) /* restart syscall */
#define EJUSTRETURN (-2) /* don't modify regs, just return */
#define ENOIOCTL (-3) /* ioctl not handled by this layer */
#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
#define ERELOOKUP (-5) /* retry the directory lookup */
#endif
# 197 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
#endif
# 199 "/home/en322/cheri/output/sdk256/sysroot/usr/include/errno.h" 3 4
# 95 "../../../../src/include/c.h" 2
#if defined(WIN32) || defined(__CYGWIN__)
#if 0 /* expanded by -frewrite-includes */
#include <fcntl.h> /* ensure O_BINARY is available */
#endif /* expanded by -frewrite-includes */
# 96 "../../../../src/include/c.h"
# 97 "../../../../src/include/c.h"
#endif
# 98 "../../../../src/include/c.h"
#if defined(WIN32) || defined(__CYGWIN__)
/* We have to redefine some system functions after they are included above. */
#if 0 /* expanded by -frewrite-includes */
#include "pg_config_os.h"
#endif /* expanded by -frewrite-includes */
# 101 "../../../../src/include/c.h"
# 102 "../../../../src/include/c.h"
#endif
# 103 "../../../../src/include/c.h"
/*
* Force disable inlining if PG_FORCE_DISABLE_INLINE is defined. This is used
* to work around compiler bugs and might also be useful for investigatory
* purposes by defining the symbol in the platform's header..
*
* This is done early (in slightly the wrong section) as functionality later
* in this file might want to rely on inline functions.
*/
#ifdef PG_FORCE_DISABLE_INLINE
#undef inline
#define inline
#endif
# 116 "../../../../src/include/c.h"
/* Must be before gettext() games below */
#if 0 /* expanded by -frewrite-includes */
#include <locale.h>
#endif /* expanded by -frewrite-includes */
# 118 "../../../../src/include/c.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 1 3 4
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)locale.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _LOCALE_H_
#define _LOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
char int_p_cs_precedes;
char int_n_cs_precedes;
char int_p_sep_by_space;
char int_n_sep_by_space;
char int_p_sign_posn;
char int_n_sign_posn;
};
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define LC_MESSAGES 6
#define _LC_LAST 7 /* marks end */
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 75 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
# 76 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
__BEGIN_DECLS
struct lconv *localeconv(void);
char *setlocale(int, const char *);
#if __POSIX_VISIBLE >= 200809
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_locale.h>
#endif /* expanded by -frewrite-includes */
# 82 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_locale.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _XLOCALE_LOCALE_H
#define _XLOCALE_LOCALE_H
/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */
#define LC_COLLATE_MASK (1<<0)
#define LC_CTYPE_MASK (1<<1)
#define LC_MONETARY_MASK (1<<2)
#define LC_NUMERIC_MASK (1<<3)
#define LC_TIME_MASK (1<<4)
#define LC_MESSAGES_MASK (1<<5)
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 50 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_locale.h" 3 4
locale_t duplocale(locale_t base);
void freelocale(locale_t loc);
locale_t newlocale(int mask, const char *locale, locale_t base);
const char *querylocale(int mask, locale_t loc);
locale_t uselocale(locale_t loc);
#endif /* _XLOCALE_LOCALE_H */
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_locale.h" 3 4
# 83 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 2 3 4
#endif
# 84 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
__END_DECLS
#endif /* _LOCALE_H_ */
# 88 "/home/en322/cheri/output/sdk256/sysroot/usr/include/locale.h" 3 4
# 119 "../../../../src/include/c.h" 2
#define _(x) gettext(x)
#ifdef ENABLE_NLS
#if 0 /* expanded by -frewrite-includes */
#include <libintl.h>
#endif /* expanded by -frewrite-includes */
# 123 "../../../../src/include/c.h"
# 124 "../../../../src/include/c.h"
#else
# 125 "../../../../src/include/c.h"
#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))
#endif
# 130 "../../../../src/include/c.h"
/*
* Use this to mark string constants as needing translation at some later
* time, rather than immediately. This is useful for cases where you need
* access to the original string and translated string, and for cases where
* immediate translation is not possible, like when initializing global
* variables.
* http://www.gnu.org/software/autoconf/manual/gettext/Special-cases.html
*/
#define gettext_noop(x) (x)
/* ----------------------------------------------------------------
* Section 1: hacks to cope with non-ANSI C compilers
*
* type prefixes (const, signed, volatile, inline) are handled in pg_config.h.
* ----------------------------------------------------------------
*/
/*
* CppAsString
* Convert the argument to a string, using the C preprocessor.
* CppConcat
* Concatenate two arguments together, using the C preprocessor.
*
* Note: There used to be support here for pre-ANSI C compilers that didn't
* support # and ##. Nowadays, these macros are just for clarity and/or
* backward compatibility with existing PostgreSQL code.
*/
#define CppAsString(identifier) #identifier
#define CppConcat(x, y) x##y
/*
* dummyret is used to set return values in macros that use ?: to make
* assignments. gcc wants these to be void, other compilers like char
*/
#ifdef __GNUC__ /* GNU cc */
#define dummyret void
#else
# 169 "../../../../src/include/c.h"
#define dummyret char
#endif
# 171 "../../../../src/include/c.h"
/* Which __func__ symbol do we have, if any? */
#ifdef HAVE_FUNCNAME__FUNC
#define PG_FUNCNAME_MACRO __func__
#else
# 176 "../../../../src/include/c.h"
#ifdef HAVE_FUNCNAME__FUNCTION
#define PG_FUNCNAME_MACRO __FUNCTION__
#else
# 179 "../../../../src/include/c.h"
#define PG_FUNCNAME_MACRO NULL
#endif
# 181 "../../../../src/include/c.h"
#endif
# 182 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 2: bool, true, false, TRUE, FALSE, NULL
* ----------------------------------------------------------------
*/
/*
* bool
* Boolean value, either true or false.
*
* XXX for C++ compilers, we assume the compiler has a compatible
* built-in definition of bool.
*/
#ifndef __cplusplus
#ifndef bool
typedef char bool;
#endif
# 201 "../../../../src/include/c.h"
#ifndef true
#define true ((bool) 1)
#endif
# 205 "../../../../src/include/c.h"
#ifndef false
#define false ((bool) 0)
#endif
# 209 "../../../../src/include/c.h"
#endif /* not C++ */
# 210 "../../../../src/include/c.h"
typedef bool *BoolPtr;
#ifndef TRUE
#define TRUE 1
#endif
# 216 "../../../../src/include/c.h"
#ifndef FALSE
#define FALSE 0
#endif
# 220 "../../../../src/include/c.h"
/*
* NULL
* Null pointer.
*/
#ifndef NULL
#define NULL ((void *) 0)
#endif
# 228 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 3: standard system types
* ----------------------------------------------------------------
*/
/*
* Pointer
* Variable holding address of any memory resident object.
*
* XXX Pointer arithmetic is done with this, so it can't be void *
* under "true" ANSI compilers.
*/
typedef char *Pointer;
/*
* intN
* Signed integer, EXACTLY N BITS IN SIZE,
* used for numerical computations and the
* frontend/backend protocol.
*/
#ifndef HAVE_INT8
typedef signed char int8; /* == 8 bits */
typedef signed short int16; /* == 16 bits */
typedef signed int int32; /* == 32 bits */
#endif /* not HAVE_INT8 */
# 255 "../../../../src/include/c.h"
/*
* uintN
* Unsigned integer, EXACTLY N BITS IN SIZE,
* used for numerical computations and the
* frontend/backend protocol.
*/
#ifndef HAVE_UINT8
typedef unsigned char uint8; /* == 8 bits */
typedef unsigned short uint16; /* == 16 bits */
typedef unsigned int uint32; /* == 32 bits */
#endif /* not HAVE_UINT8 */
# 267 "../../../../src/include/c.h"
/*
* bitsN
* Unit of bitwise operation, AT LEAST N BITS IN SIZE.
*/
typedef uint8 bits8; /* >= 8 bits */
typedef uint16 bits16; /* >= 16 bits */
typedef uint32 bits32; /* >= 32 bits */
/*
* 64-bit integers
*/
#ifdef HAVE_LONG_INT_64
/* Plain "long int" fits, use it */
#ifndef HAVE_INT64
typedef long int int64;
#endif
# 285 "../../../../src/include/c.h"
#ifndef HAVE_UINT64
typedef unsigned long int uint64;
#endif
# 288 "../../../../src/include/c.h"
#elif defined(HAVE_LONG_LONG_INT_64)
# 289 "../../../../src/include/c.h"
/* We have working support for "long long int", use that */
#ifndef HAVE_INT64
typedef long long int int64;
#endif
# 294 "../../../../src/include/c.h"
#ifndef HAVE_UINT64
typedef unsigned long long int uint64;
#endif
# 297 "../../../../src/include/c.h"
#else
# 298 "../../../../src/include/c.h"
/* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
#error must have a working 64-bit integer datatype
#endif
# 301 "../../../../src/include/c.h"
/* Decide if we need to decorate 64-bit constants */
#ifdef HAVE_LL_CONSTANTS
#define INT64CONST(x) ((int64) x##LL)
#define UINT64CONST(x) ((uint64) x##ULL)
#else
# 307 "../../../../src/include/c.h"
#define INT64CONST(x) ((int64) x)
#define UINT64CONST(x) ((uint64) x)
#endif
# 310 "../../../../src/include/c.h"
/* snprintf format strings to use for 64-bit integers */
#define INT64_FORMAT "%" INT64_MODIFIER "d"
#define UINT64_FORMAT "%" INT64_MODIFIER "u"
/*
* 128-bit signed and unsigned integers
* There currently is only a limited support for the type. E.g. 128bit
* literals and snprintf are not supported; but math is.
*/
#if defined(PG_INT128_TYPE)
#define HAVE_INT128
typedef PG_INT128_TYPE int128;
typedef unsigned PG_INT128_TYPE uint128;
#endif
# 325 "../../../../src/include/c.h"
/*
* stdint.h limits aren't guaranteed to be present and aren't guaranteed to
* have compatible types with our fixed width types. So just define our own.
*/
#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 (0xFFFFFFFF)
#define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
#define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF)
#define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF)
/* Select timestamp representation (float8 or int64) */
#ifdef USE_INTEGER_DATETIMES
#define HAVE_INT64_TIMESTAMP
#endif
# 347 "../../../../src/include/c.h"
/*
* Size
* Size of any memory resident object, as returned by sizeof.
*/
typedef size_t Size;
/*
* Index
* Index into any memory resident array.
*
* Note:
* Indices are non negative.
*/
typedef unsigned int Index;
/*
* Offset
* Offset into any memory resident array.
*
* Note:
* This differs from an Index in that an Index is always
* non negative, whereas Offset may be negative.
*/
typedef signed int Offset;
/*
* Common Postgres datatype names (as used in the catalogs)
*/
typedef float float4;
typedef double float8;
/*
* Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId,
* CommandId
*/
/* typedef Oid is in postgres_ext.h */
/*
* regproc is the type name used in the include/catalog headers, but
* RegProcedure is the preferred name in C code.
*/
typedef Oid regproc;
typedef regproc RegProcedure;
typedef uint32 TransactionId;
typedef uint32 LocalTransactionId;
typedef uint32 SubTransactionId;
#define InvalidSubTransactionId ((SubTransactionId) 0)
#define TopSubTransactionId ((SubTransactionId) 1)
/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */
typedef TransactionId MultiXactId;
typedef uint32 MultiXactOffset;
typedef uint32 CommandId;
#define FirstCommandId ((CommandId) 0)
#define InvalidCommandId (~(CommandId)0)
/*
* Array indexing support
*/
#define MAXDIM 6
typedef struct
{
int indx[MAXDIM];
} IntArray;
/* ----------------
* Variable-length datatypes all share the 'struct varlena' header.
*
* NOTE: for TOASTable types, this is an oversimplification, since the value
* may be compressed or moved out-of-line. However datatype-specific routines
* are mostly content to deal with de-TOASTed values only, and of course
* client-side routines should never see a TOASTed value. But even in a
* de-TOASTed value, beware of touching vl_len_ directly, as its representation
* is no longer convenient. It's recommended that code always use the VARDATA,
* VARSIZE, and SET_VARSIZE macros instead of relying on direct mentions of
* the struct fields. See postgres.h for details of the TOASTed form.
* ----------------
*/
struct varlena
{
char vl_len_[4]; /* Do not touch this field directly! */
char vl_dat[FLEXIBLE_ARRAY_MEMBER]; /* Data content is here */
};
#define VARHDRSZ ((int32) sizeof(int32))
/*
* These widely-used datatypes are just a varlena header and the data bytes.
* There is no terminating null or anything like that --- the data length is
* always VARSIZE(ptr) - VARHDRSZ.
*/
typedef struct varlena bytea;
typedef struct varlena text;
typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */
typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */
/*
* Specialized array types. These are physically laid out just the same
* as regular arrays (so that the regular array subscripting code works
* with them). They exist as distinct types mostly for historical reasons:
* they have nonstandard I/O behavior which we don't want to change for fear
* of breaking applications that look at the system catalogs. There is also
* an implementation issue for oidvector: it's part of the primary key for
* pg_proc, and we can't use the normal btree array support routines for that
* without circularity.
*/
typedef struct
{
int32 vl_len_; /* these fields must match ArrayType! */
int ndim; /* always 1 for int2vector */
int32 dataoffset; /* always 0 for int2vector */
Oid elemtype;
int dim1;
int lbound1;
int16 values[FLEXIBLE_ARRAY_MEMBER];
} int2vector;
typedef struct
{
int32 vl_len_; /* these fields must match ArrayType! */
int ndim; /* always 1 for oidvector */
int32 dataoffset; /* always 0 for oidvector */
Oid elemtype;
int dim1;
int lbound1;
Oid values[FLEXIBLE_ARRAY_MEMBER];
} oidvector;
/*
* Representation of a Name: effectively just a C string, but null-padded to
* exactly NAMEDATALEN bytes. The use of a struct is historical.
*/
typedef struct nameData
{
char data[NAMEDATALEN];
} NameData;
typedef NameData *Name;
#define NameStr(name) ((name).data)
/*
* Support macros for escaping strings. escape_backslash should be TRUE
* if generating a non-standard-conforming string. Prefixing a string
* with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming.
* Beware of multiple evaluation of the "ch" argument!
*/
#define SQL_STR_DOUBLE(ch, escape_backslash) \
((ch) == '\'' || ((ch) == '\\' && (escape_backslash)))
#define ESCAPE_STRING_SYNTAX 'E'
/* ----------------------------------------------------------------
* Section 4: IsValid macros for system types
* ----------------------------------------------------------------
*/
/*
* BoolIsValid
* True iff bool is valid.
*/
#define BoolIsValid(boolean) ((boolean) == false || (boolean) == true)
/*
* PointerIsValid
* True iff pointer is valid.
*/
#define PointerIsValid(pointer) ((const void*)(pointer) != NULL)
/*
* PointerIsAligned
* True iff pointer is properly aligned to point to the given type.
*/
#define PointerIsAligned(pointer, type) \
(((uintptr_t)(pointer) % (sizeof (type))) == 0)
#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid))
#define RegProcedureIsValid(p) OidIsValid(p)
/* ----------------------------------------------------------------
* Section 5: offsetof, lengthof, endof, alignment
* ----------------------------------------------------------------
*/
/*
* offsetof
* Offset of a structure/union field within that structure/union.
*
* XXX This is supposed to be part of stddef.h, but isn't on
* some systems (like SunOS 4).
*/
#ifndef offsetof
#define offsetof(type, field) ((long) &((type *)0)->field)
#endif /* offsetof */
# 549 "../../../../src/include/c.h"
/*
* lengthof
* Number of elements in an array.
*/
#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
/*
* endof
* Address of the element one past the last in an array.
*/
#define endof(array) (&(array)[lengthof(array)])
/* ----------------
* Alignment macros: align a length or address appropriately for a given type.
* The fooALIGN() macros round up to a multiple of the required alignment,
* while the fooALIGN_DOWN() macros round down. The latter are more useful
* for problems like "how many X-sized structures will fit in a page?".
*
* NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2.
* That case seems extremely unlikely to be needed in practice, however.
* ----------------
*/
#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))
/* MAXALIGN covers only built-in types, not buffers */
#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))
/*
* The above macros will not work with types wider than uintptr_t, like with
* uint64 on 32-bit platforms. That's not problem for the usual use where a
* pointer or a length is aligned, but for the odd case that you need to
* align something (potentially) wider, use TYPEALIGN64.
*/
#define TYPEALIGN64(ALIGNVAL,LEN) \
(((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1)))
/* we don't currently need wider versions of the other ALIGN macros */
#define MAXALIGN64(LEN) TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN))
/* ----------------
* Attribute macros
*
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
* Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
* XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/function_attributes.html
* XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/type_attrib.html
* ----------------
*/
/* only GCC supports the unused attribute */
#ifdef __GNUC__
#define pg_attribute_unused() __attribute__((unused))
#else
# 621 "../../../../src/include/c.h"
#define pg_attribute_unused()
#endif
# 623 "../../../../src/include/c.h"
/* GCC and XLC support format attributes */
#if defined(__GNUC__) || defined(__IBMC__)
#define pg_attribute_format_arg(a) __attribute__((format_arg(a)))
#define pg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a)))
#else
# 629 "../../../../src/include/c.h"
#define pg_attribute_format_arg(a)
#define pg_attribute_printf(f,a)
#endif
# 632 "../../../../src/include/c.h"
/* GCC, Sunpro and XLC support aligned, packed and noreturn */
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
#define pg_attribute_noreturn() __attribute__((noreturn))
#define pg_attribute_packed() __attribute__((packed))
#define HAVE_PG_ATTRIBUTE_NORETURN 1
#else
# 640 "../../../../src/include/c.h"
/*
* NB: aligned and packed are not given default definitions because they
* affect code functionality; they *must* be implemented by the compiler
* if they are to be used.
*/
#define pg_attribute_noreturn()
#endif
# 647 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 6: assertions
* ----------------------------------------------------------------
*/
/*
* USE_ASSERT_CHECKING, if defined, turns on all the assertions.
* - plai 9/5/90
*
* It should _NOT_ be defined in releases or in benchmark copies
*/
/*
* Assert() can be used in both frontend and backend code. In frontend code it
* just calls the standard assert, if it's available. If use of assertions is
* not configured, it does nothing.
*/
#ifndef USE_ASSERT_CHECKING
#define Assert(condition) ((void)true)
#define AssertMacro(condition) ((void)true)
#define AssertArg(condition) ((void)true)
#define AssertState(condition) ((void)true)
#define AssertPointerAlignment(ptr, bndr) ((void)true)
#define Trap(condition, errorType) ((void)true)
#define TrapMacro(condition, errorType) (true)
#elif defined(FRONTEND)
# 676 "../../../../src/include/c.h"
#if 0 /* expanded by -frewrite-includes */
#include <assert.h>
#endif /* expanded by -frewrite-includes */
# 677 "../../../../src/include/c.h"
# 678 "../../../../src/include/c.h"
#define Assert(p) assert(p)
#define AssertMacro(p) ((void) assert(p))
#define AssertArg(condition) assert(condition)
#define AssertState(condition) assert(condition)
#define AssertPointerAlignment(ptr, bndr) ((void)true)
#else /* USE_ASSERT_CHECKING && !FRONTEND */
# 684 "../../../../src/include/c.h"
/*
* Trap
* Generates an exception if the given condition is true.
*/
#define Trap(condition, errorType) \
do { \
if (condition) \
ExceptionalCondition(CppAsString(condition), (errorType), \
__FILE__, __LINE__); \
} while (0)
/*
* TrapMacro is the same as Trap but it's intended for use in macros:
*
* #define foo(x) (AssertMacro(x != 0), bar(x))
*
* Isn't CPP fun?
*/
#define TrapMacro(condition, errorType) \
((bool) (! (condition) || \
(ExceptionalCondition(CppAsString(condition), (errorType), \
__FILE__, __LINE__), 0)))
#define Assert(condition) \
Trap(!(condition), "FailedAssertion")
#define AssertMacro(condition) \
((void) TrapMacro(!(condition), "FailedAssertion"))
#define AssertArg(condition) \
Trap(!(condition), "BadArgument")
#define AssertState(condition) \
Trap(!(condition), "BadState")
/*
* Check that `ptr' is `bndr' aligned.
*/
#define AssertPointerAlignment(ptr, bndr) \
Trap(TYPEALIGN(bndr, (uintptr_t)(ptr)) != (uintptr_t)(ptr), \
"UnalignedPointer")
#endif /* USE_ASSERT_CHECKING && !FRONTEND */
# 728 "../../../../src/include/c.h"
/*
* Macros to support compile-time assertion checks.
*
* If the "condition" (a compile-time-constant expression) evaluates to false,
* throw a compile error using the "errmessage" (a string literal).
*
* gcc 4.6 and up supports _Static_assert(), but there are bizarre syntactic
* placement restrictions. These macros make it safe to use as a statement
* or in an expression, respectively.
*
* Otherwise we fall back on a kluge that assumes the compiler will complain
* about a negative width for a struct bit-field. This will not include a
* helpful error message, but it beats not getting an error at all.
*/
#ifdef HAVE__STATIC_ASSERT
#define StaticAssertStmt(condition, errmessage) \
do { _Static_assert(condition, errmessage); } while(0)
#define StaticAssertExpr(condition, errmessage) \
({ StaticAssertStmt(condition, errmessage); true; })
#else /* !HAVE__STATIC_ASSERT */
# 749 "../../../../src/include/c.h"
#define StaticAssertStmt(condition, errmessage) \
((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))
#define StaticAssertExpr(condition, errmessage) \
StaticAssertStmt(condition, errmessage)
#endif /* HAVE__STATIC_ASSERT */
# 754 "../../../../src/include/c.h"
/*
* Compile-time checks that a variable (or expression) has the specified type.
*
* AssertVariableIsOfType() can be used as a statement.
* AssertVariableIsOfTypeMacro() is intended for use in macros, eg
* #define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x))
*
* If we don't have __builtin_types_compatible_p, we can still assert that
* the types have the same size. This is far from ideal (especially on 32-bit
* platforms) but it provides at least some coverage.
*/
#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P
#define AssertVariableIsOfType(varname, typename) \
StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \
CppAsString(varname) " does not have type " CppAsString(typename))
#define AssertVariableIsOfTypeMacro(varname, typename) \
((void) StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
CppAsString(varname) " does not have type " CppAsString(typename)))
#else /* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */
# 775 "../../../../src/include/c.h"
#define AssertVariableIsOfType(varname, typename) \
StaticAssertStmt(sizeof(varname) == sizeof(typename), \
CppAsString(varname) " does not have type " CppAsString(typename))
#define AssertVariableIsOfTypeMacro(varname, typename) \
((void) StaticAssertExpr(sizeof(varname) == sizeof(typename), \
CppAsString(varname) " does not have type " CppAsString(typename)))
#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */
# 782 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 7: widely useful macros
* ----------------------------------------------------------------
*/
/*
* Max
* Return the maximum of two numbers.
*/
#define Max(x, y) ((x) > (y) ? (x) : (y))
/*
* Min
* Return the minimum of two numbers.
*/
#define Min(x, y) ((x) < (y) ? (x) : (y))
/*
* Abs
* Return the absolute value of the argument.
*/
#define Abs(x) ((x) >= 0 ? (x) : -(x))
/*
* StrNCpy
* Like standard library function strncpy(), except that result string
* is guaranteed to be null-terminated --- that is, at most N-1 bytes
* of the source string will be kept.
* Also, the macro returns no result (too hard to do that without
* evaluating the arguments multiple times, which seems worse).
*
* BTW: when you need to copy a non-null-terminated string (like a text
* datum) and add a null, do not do it with StrNCpy(..., len+1). That
* might seem to work, but it fetches one byte more than there is in the
* text object. One fine day you'll have a SIGSEGV because there isn't
* another byte before the end of memory. Don't laugh, we've had real
* live bug reports from real live users over exactly this mistake.
* Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead.
*/
#define StrNCpy(dst,src,len) \
do \
{ \
char * _dst = (dst); \
Size _len = (len); \
\
if (_len > 0) \
{ \
strncpy(_dst, (src), _len); \
_dst[_len-1] = '\0'; \
} \
} while (0)
/* Get a bit mask of the bits set in non-long aligned addresses */
#define LONG_ALIGN_MASK (sizeof(long) - 1)
/*
* MemSet
* Exactly the same as standard library function memset(), but considerably
* faster for zeroing small word-aligned structures (such as parsetree nodes).
* This has to be a macro because the main point is to avoid function-call
* overhead. However, we have also found that the loop is faster than
* native libc memset() on some platforms, even those with assembler
* memset() functions. More research needs to be done, perhaps with
* MEMSET_LOOP_LIMIT tests in configure.
*/
#define MemSet(start, val, len) \
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) & (uintptr_t)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)
/*
* MemSetAligned is the same as MemSet except it omits the test to see if
* "start" is word-aligned. This is okay to use if the caller knows a-priori
* that the pointer is suitably aligned (typically, because he just got it
* from palloc(), which always delivers a max-aligned pointer).
*/
#define MemSetAligned(start, val, len) \
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)
/*
* MemSetTest/MemSetLoop are a variant version that allow all the tests in
* MemSet to be done at compile time in cases where "val" and "len" are
* constants *and* we know the "start" pointer must be word-aligned.
* If MemSetTest succeeds, then it is okay to use MemSetLoop, otherwise use
* MemSetAligned. Beware of multiple evaluations of the arguments when using
* this approach.
*/
#define MemSetTest(val, len) \
( ((len) & LONG_ALIGN_MASK) == 0 && \
(len) <= MEMSET_LOOP_LIMIT && \
MEMSET_LOOP_LIMIT != 0 && \
(val) == 0 )
#define MemSetLoop(start, val, len) \
do \
{ \
long * _start = (long *) (start); \
long * _stop = (long *) ((char *) _start + (Size) (len)); \
\
while (_start < _stop) \
*_start++ = 0; \
} while (0)
/*
* Mark a point as unreachable in a portable fashion. This should preferably
* be something that the compiler understands, to aid code generation.
* In assert-enabled builds, we prefer abort() for debugging reasons.
*/
#if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING)
#define pg_unreachable() __builtin_unreachable()
#elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING)
# 936 "../../../../src/include/c.h"
#define pg_unreachable() __assume(0)
#else
# 938 "../../../../src/include/c.h"
#define pg_unreachable() abort()
#endif
# 940 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 8: random stuff
* ----------------------------------------------------------------
*/
/* msb for char */
#define HIGHBIT (0x80)
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)
#define STATUS_OK (0)
#define STATUS_ERROR (-1)
#define STATUS_EOF (-2)
#define STATUS_FOUND (1)
#define STATUS_WAITING (2)
/*
* Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only
* used in assert-enabled builds, to avoid compiler warnings about unused
* variables in assert-disabled builds.
*/
#ifdef USE_ASSERT_CHECKING
#define PG_USED_FOR_ASSERTS_ONLY
#else
# 966 "../../../../src/include/c.h"
#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
#endif
# 968 "../../../../src/include/c.h"
/* gettext domain name mangling */
/*
* To better support parallel installations of major PostgeSQL
* versions as well as parallel installations of major library soname
* versions, we mangle the gettext domain name by appending those
* version numbers. The coding rule ought to be that wherever the
* domain name is mentioned as a literal, it must be wrapped into
* PG_TEXTDOMAIN(). The macros below do not work on non-literals; but
* that is somewhat intentional because it avoids having to worry
* about multiple states of premangling and postmangling as the values
* are being passed around.
*
* Make sure this matches the installation rules in nls-global.mk.
*/
/* need a second indirection because we want to stringize the macro value, not the name */
#define CppAsString2(x) CppAsString(x)
#ifdef SO_MAJOR_VERSION
#define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION)
#else
# 992 "../../../../src/include/c.h"
#define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION)
#endif
# 994 "../../../../src/include/c.h"
/* ----------------------------------------------------------------
* Section 9: system-specific hacks
*
* This should be limited to things that absolutely have to be
* included in every source file. The port-specific header file
* is usually a better place for this sort of thing.
* ----------------------------------------------------------------
*/
/*
* NOTE: this is also used for opening text files.
* WIN32 treats Control-Z as EOF in files opened in text mode.
* Therefore, we open files in binary mode on Win32 so we can read
* literal control-Z. The other affect is that we see CRLF, but
* that is OK because we can already handle those cleanly.
*/
#if defined(WIN32) || defined(__CYGWIN__)
#define PG_BINARY O_BINARY
#define PG_BINARY_A "ab"
#define PG_BINARY_R "rb"
#define PG_BINARY_W "wb"
#else
# 1018 "../../../../src/include/c.h"
#define PG_BINARY 0
#define PG_BINARY_A "a"
#define PG_BINARY_R "r"
#define PG_BINARY_W "w"
#endif
# 1023 "../../../../src/include/c.h"
/*
* Provide prototypes for routines not present in a particular machine's
* standard C library.
*/
#if !HAVE_DECL_SNPRINTF
extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
#endif
# 1032 "../../../../src/include/c.h"
#if !HAVE_DECL_VSNPRINTF
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#endif
# 1036 "../../../../src/include/c.h"
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
#define memmove(d, s, c) bcopy(s, d, c)
#endif
# 1040 "../../../../src/include/c.h"
/* no special DLL markers on most ports */
#ifndef PGDLLIMPORT
#define PGDLLIMPORT
#endif
# 1045 "../../../../src/include/c.h"
#ifndef PGDLLEXPORT
#define PGDLLEXPORT
#endif
# 1048 "../../../../src/include/c.h"
/*
* The following is used as the arg list for signal handlers. Any ports
* that take something other than an int argument should override this in
* their pg_config_os.h file. Note that variable names are required
* because it is used in both the prototypes as well as the definitions.
* Note also the long name. We expect that this won't collide with
* other names causing compiler warnings.
*/
#ifndef SIGNAL_ARGS
#define SIGNAL_ARGS int postgres_signal_arg
#endif
# 1061 "../../../../src/include/c.h"
/*
* When there is no sigsetjmp, its functionality is provided by plain
* setjmp. Incidentally, nothing provides setjmp's functionality in
* that case. We now support the case only on Windows.
*/
#ifdef WIN32
#define sigjmp_buf jmp_buf
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
#endif
# 1072 "../../../../src/include/c.h"
#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
extern int fdatasync(int fildes);
#endif
# 1076 "../../../../src/include/c.h"
/* If strtoq() exists, rename it to the more standard strtoll() */
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
#define strtoll strtoq
#define HAVE_STRTOLL 1
#endif
# 1082 "../../../../src/include/c.h"
/* If strtouq() exists, rename it to the more standard strtoull() */
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
#define strtoull strtouq
#define HAVE_STRTOULL 1
#endif
# 1088 "../../../../src/include/c.h"
/*
* We assume if we have these two functions, we have their friends too, and
* can use the wide-character functions.
*/
#if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER)
#define USE_WIDE_UPPER_LOWER
#endif
# 1096 "../../../../src/include/c.h"
/* EXEC_BACKEND defines */
#ifdef EXEC_BACKEND
#define NON_EXEC_STATIC
#else
# 1101 "../../../../src/include/c.h"
#define NON_EXEC_STATIC static
#endif
# 1103 "../../../../src/include/c.h"
/* typedef for virtual addresses */
#if defined(__has_attribute) && __has_attribute(memory_address)
#define pg_attribute_memory_address() __attribute__((memory_address))
#else
# 1108 "../../../../src/include/c.h"
#define pg_attribute_memory_address()
#endif
# 1110 "../../../../src/include/c.h"
#ifdef __CHERI_PURE_CAPABILITY__
typedef pg_attribute_memory_address() __uintcap_t pg_vaddr_t;
#else
# 1114 "../../../../src/include/c.h"
typedef pg_attribute_memory_address() uintptr_t pg_vaddr_t;
#endif
# 1116 "../../../../src/include/c.h"
/* /port compatibility functions */
#if 0 /* expanded by -frewrite-includes */
#include "port.h"
#endif /* expanded by -frewrite-includes */
# 1119 "../../../../src/include/c.h"
# 1 "../../../../src/include/port.h" 1
/*-------------------------------------------------------------------------
*
* port.h
* Header for src/port/ compatibility functions.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/port.h
*
*-------------------------------------------------------------------------
*/
#ifndef PG_PORT_H
#define PG_PORT_H
#if 0 /* expanded by -frewrite-includes */
#include <ctype.h>
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/port.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 1 3 4
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ctype.h 8.4 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _CTYPE_H_
#define _CTYPE_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <_ctype.h>
#endif /* expanded by -frewrite-includes */
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 1 3 4
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From @(#)ctype.h 8.4 (Berkeley) 1/21/94
* From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp
* $FreeBSD$
*/
#ifndef __CTYPE_H_
#define __CTYPE_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
#define _CTYPE_A 0x00000100L /* Alpha */
#define _CTYPE_C 0x00000200L /* Control */
#define _CTYPE_D 0x00000400L /* Digit */
#define _CTYPE_G 0x00000800L /* Graph */
#define _CTYPE_L 0x00001000L /* Lower */
#define _CTYPE_P 0x00002000L /* Punct */
#define _CTYPE_S 0x00004000L /* Space */
#define _CTYPE_U 0x00008000L /* Upper */
#define _CTYPE_X 0x00010000L /* X digit */
#define _CTYPE_B 0x00020000L /* Blank */
#define _CTYPE_R 0x00040000L /* Print */
#define _CTYPE_I 0x00080000L /* Ideogram */
#define _CTYPE_T 0x00100000L /* Special */
#define _CTYPE_Q 0x00200000L /* Phonogram */
#define _CTYPE_N 0x00400000L /* Number (superset of digit) */
#define _CTYPE_SW0 0x20000000L /* 0 width character */
#define _CTYPE_SW1 0x40000000L /* 1 width character */
#define _CTYPE_SW2 0x80000000L /* 2 width character */
#define _CTYPE_SW3 0xc0000000L /* 3 width character */
#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */
#define _CTYPE_SWS 30 /* Bits to shift to get width */
/* See comments in <sys/_types.h> about __ct_rune_t. */
__BEGIN_DECLS
unsigned long ___runetype(__ct_rune_t) __pure;
__ct_rune_t ___tolower(__ct_rune_t) __pure;
__ct_rune_t ___toupper(__ct_rune_t) __pure;
__END_DECLS
/*
* _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us
* to generate code for extern versions of all our inline functions.
*/
#ifdef _EXTERNALIZE_CTYPE_INLINES_
#define _USE_CTYPE_INLINE_
#define static
#define __inline
#endif
# 86 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
extern int __mb_sb_limit;
/*
* Use inline functions if we are allowed to and the compiler supports them.
*/
#if !defined(_DONT_USE_CTYPE_INLINE_) && \
(defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
#if 0 /* expanded by -frewrite-includes */
#include <runetype.h>
#endif /* expanded by -frewrite-includes */
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 1 3 4
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)runetype.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _RUNETYPE_H_
#define _RUNETYPE_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
#define _CACHED_RUNES (1 <<8 ) /* Must be a power of 2 */
#define _CRMASK (~(_CACHED_RUNES - 1))
/*
* The lower 8 bits of runetype[] contain the digit value of the rune.
*/
typedef struct {
__rune_t __min; /* First rune of the range */
__rune_t __max; /* Last rune (inclusive) of the range */
__rune_t __map; /* What first maps to in maps */
unsigned long *__types; /* Array of types in range */
} _RuneEntry;
typedef struct {
int __nranges; /* Number of ranges stored */
_RuneEntry *__ranges; /* Pointer to the ranges */
} _RuneRange;
typedef struct {
char __magic[8]; /* Magic saying what version we are */
char __encoding[32]; /* ASCII name of this encoding */
__rune_t (*__sgetrune)(const char *, __size_t, char const **);
int (*__sputrune)(__rune_t, char *, __size_t, char **);
__rune_t __invalid_rune;
unsigned long __runetype[_CACHED_RUNES];
__rune_t __maplower[_CACHED_RUNES];
__rune_t __mapupper[_CACHED_RUNES];
/*
* The following are to deal with Runes larger than _CACHED_RUNES - 1.
* Their data is actually contiguous with this structure so as to make
* it easier to read/write from/to disk.
*/
_RuneRange __runetype_ext;
_RuneRange __maplower_ext;
_RuneRange __mapupper_ext;
void *__variable; /* Data which depends on the encoding */
int __variable_len; /* how long that data is */
} _RuneLocale;
#define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */
__BEGIN_DECLS
extern const _RuneLocale _DefaultRuneLocale;
extern const _RuneLocale *_CurrentRuneLocale;
#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
extern const _RuneLocale *__getCurrentRuneLocale(void);
#else
# 92 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
static __inline const _RuneLocale *__getCurrentRuneLocale(void)
{
if (_ThreadRuneLocale)
return _ThreadRuneLocale;
if (_CurrentRuneLocale)
return _CurrentRuneLocale;
return &_DefaultRuneLocale;
}
#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
# 103 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
#define _CurrentRuneLocale (__getCurrentRuneLocale())
__END_DECLS
#endif /* !_RUNETYPE_H_ */
# 107 "/home/en322/cheri/output/sdk256/sysroot/usr/include/runetype.h" 3 4
# 96 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 2 3 4
static __inline int
__maskrune(__ct_rune_t _c, unsigned long _f)
{
return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) :
_CurrentRuneLocale->__runetype[_c]) & _f;
}
static __inline int
__sbmaskrune(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
_CurrentRuneLocale->__runetype[_c] & _f;
}
static __inline int
__istype(__ct_rune_t _c, unsigned long _f)
{
return (!!__maskrune(_c, _f));
}
static __inline int
__sbistype(__ct_rune_t _c, unsigned long _f)
{
return (!!__sbmaskrune(_c, _f));
}
static __inline int
__isctype(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= 128) ? 0 :
!!(_DefaultRuneLocale.__runetype[_c] & _f);
}
static __inline __ct_rune_t
__toupper(__ct_rune_t _c)
{
return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) :
_CurrentRuneLocale->__mapupper[_c];
}
static __inline __ct_rune_t
__sbtoupper(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__mapupper[_c];
}
static __inline __ct_rune_t
__tolower(__ct_rune_t _c)
{
return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) :
_CurrentRuneLocale->__maplower[_c];
}
static __inline __ct_rune_t
__sbtolower(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__maplower[_c];
}
static __inline int
__wcwidth(__ct_rune_t _c)
{
unsigned int _x;
if (_c == 0)
return (0);
_x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R);
if ((_x & _CTYPE_SWM) != 0)
return ((_x & _CTYPE_SWM) >> _CTYPE_SWS);
return ((_x & _CTYPE_R) != 0 ? 1 : -1);
}
#else /* not using inlines */
# 172 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
__BEGIN_DECLS
int __maskrune(__ct_rune_t, unsigned long);
int __sbmaskrune(__ct_rune_t, unsigned long);
int __istype(__ct_rune_t, unsigned long);
int __sbistype(__ct_rune_t, unsigned long);
int __isctype(__ct_rune_t, unsigned long);
__ct_rune_t __toupper(__ct_rune_t);
__ct_rune_t __sbtoupper(__ct_rune_t);
__ct_rune_t __tolower(__ct_rune_t);
__ct_rune_t __sbtolower(__ct_rune_t);
int __wcwidth(__ct_rune_t);
__END_DECLS
#endif /* using inlines */
# 186 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
#endif /* !__CTYPE_H_ */
# 188 "/home/en322/cheri/output/sdk256/sysroot/usr/include/_ctype.h" 3 4
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 2 3 4
__BEGIN_DECLS
int isalnum(int);
int isalpha(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int tolower(int);
int toupper(int);
#if __XSI_VISIBLE
int isascii(int);
int toascii(int);
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __ISO_C_VISIBLE >= 1999
int isblank(int);
#endif
# 71 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __BSD_VISIBLE
int digittoint(int);
int ishexnumber(int);
int isideogram(int);
int isnumber(int);
int isphonogram(int);
int isrune(int);
int isspecial(int);
#endif
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_ctype.h>
#endif /* expanded by -frewrite-includes */
# 83 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 1 3 4
/*-
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#if (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \
(!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H))
#ifdef _XLOCALE_WCTYPES
#define _XLOCALE_WCTYPE_H
#else
# 39 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#define _XLOCALE_CTYPE_H
#endif
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 46 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#ifndef _XLOCALE_RUN_FUNCTIONS_DEFINED
#define _XLOCALE_RUN_FUNCTIONS_DEFINED 1
unsigned long ___runetype_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure;
_RuneLocale *__runes_for_locale(locale_t, int*);
#endif
# 54 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#ifndef _XLOCALE_INLINE
#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
/* GNU89 inline has nonstandard semantics. */
#define _XLOCALE_INLINE extern __inline
#else
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
/* Hack to work around people who define inline away */
#ifdef inline
#define _XLOCALE_INLINE static __inline
#else
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
/* Define with C++ / C99 compatible semantics */
#define _XLOCALE_INLINE inline
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#endif
# 68 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#endif /* _XLOCALE_INLINE */
# 69 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#ifdef _XLOCALE_WCTYPES
_XLOCALE_INLINE int
__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
_XLOCALE_INLINE int
__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
_XLOCALE_INLINE int
__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
{
int __limit;
_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
runes->__runetype[__c]) & __f;
}
_XLOCALE_INLINE int
__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
{
return (!!__maskrune_l(__c, __f, __loc));
}
#define XLOCALE_ISCTYPE(fname, cat) \
_XLOCALE_INLINE int isw##fname##_l(int, locale_t);\
_XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\
{ return __istype_l(__c, cat, __l); }
#else
# 96 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
_XLOCALE_INLINE int
__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
_XLOCALE_INLINE int
__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
_XLOCALE_INLINE int
__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
{
int __limit;
_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
return (__c < 0 || __c >= __limit) ? 0 :
runes->__runetype[__c] & __f;
}
_XLOCALE_INLINE int
__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
{
return (!!__sbmaskrune_l(__c, __f, __loc));
}
#define XLOCALE_ISCTYPE(__fname, __cat) \
_XLOCALE_INLINE int is##__fname##_l(int, locale_t); \
_XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\
{ return __sbistype_l(__c, __cat, __l); }
#endif
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D|_CTYPE_N)
XLOCALE_ISCTYPE(alpha, _CTYPE_A)
XLOCALE_ISCTYPE(blank, _CTYPE_B)
XLOCALE_ISCTYPE(cntrl, _CTYPE_C)
XLOCALE_ISCTYPE(digit, _CTYPE_D)
XLOCALE_ISCTYPE(graph, _CTYPE_G)
XLOCALE_ISCTYPE(hexnumber, _CTYPE_X)
XLOCALE_ISCTYPE(ideogram, _CTYPE_I)
XLOCALE_ISCTYPE(lower, _CTYPE_L)
XLOCALE_ISCTYPE(number, _CTYPE_D|_CTYPE_N)
XLOCALE_ISCTYPE(phonogram, _CTYPE_Q)
XLOCALE_ISCTYPE(print, _CTYPE_R)
XLOCALE_ISCTYPE(punct, _CTYPE_P)
XLOCALE_ISCTYPE(rune, 0xFFFFFF00L)
XLOCALE_ISCTYPE(space, _CTYPE_S)
XLOCALE_ISCTYPE(special, _CTYPE_T)
XLOCALE_ISCTYPE(upper, _CTYPE_U)
XLOCALE_ISCTYPE(xdigit, _CTYPE_X)
#undef XLOCALE_ISCTYPE
#ifdef _XLOCALE_WCTYPES
_XLOCALE_INLINE int towlower_l(int, locale_t);
_XLOCALE_INLINE int __wcwidth_l(__ct_rune_t, locale_t);
_XLOCALE_INLINE int towupper_l(int, locale_t);
_XLOCALE_INLINE int towlower_l(int __c, locale_t __l)
{
int __limit;
_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) :
__runes->__maplower[__c];
}
_XLOCALE_INLINE int towupper_l(int __c, locale_t __l)
{
int __limit;
_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) :
__runes->__mapupper[__c];
}
_XLOCALE_INLINE int
__wcwidth_l(__ct_rune_t _c, locale_t __l)
{
unsigned int _x;
if (_c == 0)
return (0);
_x = (unsigned int)__maskrune_l(_c, _CTYPE_SWM|_CTYPE_R, __l);
if ((_x & _CTYPE_SWM) != 0)
return ((_x & _CTYPE_SWM) >> _CTYPE_SWS);
return ((_x & _CTYPE_R) != 0 ? 1 : -1);
}
int iswctype_l(wint_t __wc, wctype_t __charclass, locale_t __l);
wctype_t wctype_l(const char *property, locale_t __l);
wint_t towctrans_l(wint_t __wc, wctrans_t desc, locale_t __l);
wint_t nextwctype_l(wint_t __wc, wctype_t wct, locale_t __l);
wctrans_t wctrans_l(const char *__charclass, locale_t __l);
#undef _XLOCALE_WCTYPES
#else
# 180 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
_XLOCALE_INLINE int digittoint_l(int, locale_t);
_XLOCALE_INLINE int tolower_l(int, locale_t);
_XLOCALE_INLINE int toupper_l(int, locale_t);
_XLOCALE_INLINE int digittoint_l(int __c, locale_t __l)
{ return __sbmaskrune_l((__c), 0xFF, __l); }
_XLOCALE_INLINE int tolower_l(int __c, locale_t __l)
{
int __limit;
_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
return (__c < 0 || __c >= __limit) ? __c :
__runes->__maplower[__c];
}
_XLOCALE_INLINE int toupper_l(int __c, locale_t __l)
{
int __limit;
_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
return (__c < 0 || __c >= __limit) ? __c :
__runes->__mapupper[__c];
}
#endif
# 202 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
#endif /* (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \
(!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H)) */
# 204 "/home/en322/cheri/output/sdk256/sysroot/usr/include/xlocale/_ctype.h" 3 4
# 84 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 2 3 4
#endif
# 85 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
__END_DECLS
#ifndef __cplusplus
#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D|_CTYPE_N)
#define isalpha(c) __sbistype((c), _CTYPE_A)
#define iscntrl(c) __sbistype((c), _CTYPE_C)
#define isdigit(c) __sbistype((c), _CTYPE_D)
#define isgraph(c) __sbistype((c), _CTYPE_G)
#define islower(c) __sbistype((c), _CTYPE_L)
#define isprint(c) __sbistype((c), _CTYPE_R)
#define ispunct(c) __sbistype((c), _CTYPE_P)
#define isspace(c) __sbistype((c), _CTYPE_S)
#define isupper(c) __sbistype((c), _CTYPE_U)
#define isxdigit(c) __sbistype((c), _CTYPE_X)
#define tolower(c) __sbtolower(c)
#define toupper(c) __sbtoupper(c)
#endif /* !__cplusplus */
# 102 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __XSI_VISIBLE
/*
* POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
* tolower() and toupper() respectively, minus extra checking to ensure that
* the argument is a lower or uppercase letter respectively. We've chosen to
* implement these macros with the same error checking as tolower() and
* toupper() since this doesn't violate the specification itself, only its
* intent. We purposely leave _tolower() and _toupper() undocumented to
* discourage their use.
*
* XXX isascii() and toascii() should similarly be undocumented.
*/
#define _tolower(c) __sbtolower(c)
#define _toupper(c) __sbtoupper(c)
#define isascii(c) (((c) & ~0x7F) == 0)
#define toascii(c) ((c) & 0x7F)
#endif
# 120 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)
#define isblank(c) __sbistype((c), _CTYPE_B)
#endif
# 124 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#if __BSD_VISIBLE
#define digittoint(c) __sbmaskrune((c), 0xFF)
#define ishexnumber(c) __sbistype((c), _CTYPE_X)
#define isideogram(c) __sbistype((c), _CTYPE_I)
#define isnumber(c) __sbistype((c), _CTYPE_D|_CTYPE_N)
#define isphonogram(c) __sbistype((c), _CTYPE_Q)
#define isrune(c) __sbistype((c), 0xFFFFFF00L)
#define isspecial(c) __sbistype((c), _CTYPE_T)
#endif
# 134 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
#endif /* !_CTYPE_H_ */
# 136 "/home/en322/cheri/output/sdk256/sysroot/usr/include/ctype.h" 3 4
# 17 "../../../../src/include/port.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <netdb.h>
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/port.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 1 3 4
/*-
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
* $FreeBSD$
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _IN_ADDR_T_DECLARED
typedef __uint32_t in_addr_t;
#define _IN_ADDR_T_DECLARED
#endif
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _IN_PORT_T_DECLARED
typedef __uint16_t in_port_t;
#define _IN_PORT_T_DECLARED
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _SOCKLEN_T_DECLARED
typedef __socklen_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
# 82 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
# 87 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#ifndef _PATH_HEQUIV
# define _PATH_HEQUIV "/etc/hosts.equiv"
#endif
# 91 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
#define _PATH_SERVICES_DB "/var/db/services.db"
#define h_errno (*__h_errno())
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* AF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#define IPPORT_RESERVED 1024
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/*
* Error return codes from getaddrinfo()
*/
#if 0
/* obsoleted */
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#endif
# 166 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#if 0
/* obsoleted */
#define EAI_NODATA 7 /* no address associated with hostname */
#endif
# 175 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12 /* invalid value for hints */
#define EAI_PROTOCOL 13 /* resolved protocol is unknown */
#define EAI_OVERFLOW 14 /* argument buffer overflow */
#define EAI_MAX 15
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
/* valid flags for addrinfo (not a standard def, apps should not use it) */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
AI_ADDRCONFIG | AI_ALL | AI_V4MAPPED)
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_NUMERICSCOPE 0x00000020
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
__BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 200112)
struct hostent *gethostbyaddr(const void *, socklen_t, int);
struct hostent *gethostbyname(const char *);
#endif
# 233 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
struct hostent *gethostent(void);
struct netent *getnetbyaddr(uint32_t, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
struct protoent *getprotobynumber(int);
struct protoent *getprotoent(void);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
void sethostent(int);
/* void sethostfile(const char *); */
void setnetent(int);
void setprotoent(int);
int getaddrinfo(const char *, const char *,
const struct addrinfo *, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *,
size_t, char *, size_t, int);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
void setservent(int);
#if __BSD_VISIBLE
void endnetgrent(void);
void freehostent(struct hostent *);
int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *,
char *, size_t, struct hostent **, int *);
int gethostbyname_r(const char *, struct hostent *, char *, size_t,
struct hostent **, int *);
struct hostent *gethostbyname2(const char *, int);
int gethostbyname2_r(const char *, int, struct hostent *, char *,
size_t, struct hostent **, int *);
int gethostent_r(struct hostent *, char *, size_t,
struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t,
struct netent**, int *);
int getnetbyname_r(const char *, struct netent *, char *, size_t,
struct netent **, int *);
int getnetent_r(struct netent *, char *, size_t, struct netent **,
int *);
int getnetgrent(char **, char **, char **);
int getnetgrent_r(char **, char **, char **, char *, size_t);
int getprotobyname_r(const char *, struct protoent *, char *,
size_t, struct protoent **);
int getprotobynumber_r(int, struct protoent *, char *, size_t,
struct protoent **);
int getprotoent_r(struct protoent *, char *, size_t,
struct protoent **);
int getservbyname_r(const char *, const char *, struct servent *,
char *, size_t, struct servent **);
int getservbyport_r(int, const char *, struct servent *, char *,
size_t, struct servent **);
int getservent_r(struct servent *, char *, size_t,
struct servent **);
void herror(const char *);
const char *hstrerror(int);
int innetgr(const char *, const char *, const char *, const char *);
void setnetgrent(const char *);
#endif
# 294 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
/*
* PRIVATE functions specific to the FreeBSD implementation
*/
/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
int * __h_errno(void);
__END_DECLS
#endif /* !_NETDB_H_ */
# 305 "/home/en322/cheri/output/sdk256/sysroot/usr/include/netdb.h" 3 4
# 18 "../../../../src/include/port.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <pwd.h>
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/port.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 1 3 4
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pwd.h 8.2 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _PWD_H_
#define _PWD_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#ifndef _GID_T_DECLARED
typedef __gid_t gid_t;
#define _GID_T_DECLARED
#endif
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 53 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#ifndef _UID_T_DECLARED
typedef __uid_t uid_t;
#define _UID_T_DECLARED
#endif
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#define _PATH_PWD "/etc"
#define _PATH_PASSWD "/etc/passwd"
#define _PASSWD "passwd"
#define _PATH_MASTERPASSWD "/etc/master.passwd"
#define _MASTERPASSWD "master.passwd"
#define _PATH_MP_DB "/etc/pwd.db"
#define _MP_DB "pwd.db"
#define _PATH_SMP_DB "/etc/spwd.db"
#define _SMP_DB "spwd.db"
#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format
* `1 octet tag | key', where the tag is one of the _PW_KEY* values
* listed below. These values happen to be ASCII digits. Starting
* with FreeBSD 5.1, the tag is now still a single octet, but the
* upper 4 bits are interpreted as a version. Pre-FreeBSD 5.1 format
* entries are version `3' -- this conveniently results in the same
* key values as before. The new, architecture-independent entries
* are version `4'.
* As it happens, some applications read the database directly.
* (Bad app, no cookie!) Thus, we leave the _PW_KEY* symbols at their
* old pre-FreeBSD 5.1 values so these apps still work. Consequently
* we have to muck around a bit more to get the correct, versioned
* tag, and that is what the _PW_VERSIONED macro is about.
*/
#define _PW_VERSION_MASK '\xF0'
#define _PW_VERSIONED(x, v) ((unsigned char)(((x) & 0xCF) | ((v)<<4)))
#define _PW_KEYBYNAME '\x31' /* stored by name */
#define _PW_KEYBYNUM '\x32' /* stored by entry in the "file" */
#define _PW_KEYBYUID '\x33' /* stored by uid */
#define _PW_KEYYPENABLED '\x34' /* YP is enabled */
#define _PW_KEYYPBYNUM '\x35' /* special +@netgroup entries */
/* The database also contains a key to indicate the format version of
* the entries therein. There may be other, older versioned entries
* as well.
*/
#define _PWD_VERSION_KEY "\xFF" "VERSION"
#define _PWD_CURRENT_VERSION '\x04'
#define _PASSWORD_EFMT1 '_' /* extended encryption format */
#define _PASSWORD_LEN 128 /* max length, not counting NULL */
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* encrypted password */
uid_t pw_uid; /* user uid */
gid_t pw_gid; /* user gid */
time_t pw_change; /* password change time */
char *pw_class; /* user access class */
char *pw_gecos; /* Honeywell login info */
char *pw_dir; /* home directory */
char *pw_shell; /* default shell */
time_t pw_expire; /* account expiration */
int pw_fields; /* internal: fields filled in */
};
/* Mapping from fields to bits for pw_fields. */
#define _PWF(x) (1 << x)
#define _PWF_NAME _PWF(0)
#define _PWF_PASSWD _PWF(1)
#define _PWF_UID _PWF(2)
#define _PWF_GID _PWF(3)
#define _PWF_CHANGE _PWF(4)
#define _PWF_CLASS _PWF(5)
#define _PWF_GECOS _PWF(6)
#define _PWF_DIR _PWF(7)
#define _PWF_SHELL _PWF(8)
#define _PWF_EXPIRE _PWF(9)
/* XXX These flags are bogus. With nsswitch, there are many
* possible sources and they cannot be represented in a small integer.
*/
#define _PWF_SOURCE 0x3000
#define _PWF_FILES 0x1000
#define _PWF_NIS 0x2000
#define _PWF_HESIOD 0x3000
__BEGIN_DECLS
struct passwd *getpwnam(const char *);
struct passwd *getpwuid(uid_t);
#if __XSI_VISIBLE >= 500
void endpwent(void);
struct passwd *getpwent(void);
void setpwent(void);
#endif
# 156 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
int getpwnam_r(const char *, struct passwd *, char *, size_t,
struct passwd **);
int getpwuid_r(uid_t, struct passwd *, char *, size_t,
struct passwd **);
#endif
# 163 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
#if __BSD_VISIBLE
int getpwent_r(struct passwd *, char *, size_t, struct passwd **);
int setpassent(int);
const char *user_from_uid(uid_t, int);
int uid_from_user(const char *, uid_t *);
int pwcache_userdb(int (*)(int), void (*)(void),
struct passwd * (*)(const char *),
struct passwd * (*)(uid_t));
#endif
# 173 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
__END_DECLS
#endif /* !_PWD_H_ */
# 176 "/home/en322/cheri/output/sdk256/sysroot/usr/include/pwd.h" 3 4
# 19 "../../../../src/include/port.h" 2
/* socket has a different definition on WIN32 */
#ifndef WIN32
typedef int pgsocket;
#define PGINVALID_SOCKET (-1)
#else
# 26 "../../../../src/include/port.h"
typedef SOCKET pgsocket;
#define PGINVALID_SOCKET INVALID_SOCKET
#endif
# 30 "../../../../src/include/port.h"
/* non-blocking */
extern bool pg_set_noblock(pgsocket sock);
extern bool pg_set_block(pgsocket sock);
/* Portable path handling for Unix/Win32 (in path.c) */
extern bool has_drive_prefix(const char *filename);
extern char *first_dir_separator(const char *filename);
extern char *last_dir_separator(const char *filename);
extern char *first_path_var_separator(const char *pathlist);
extern void join_path_components(char *ret_path,
const char *head, const char *tail);
extern void canonicalize_path(char *path);
extern void make_native_path(char *path);
extern void cleanup_path(char *path);
extern bool path_contains_parent_reference(const char *path);
extern bool path_is_relative_and_below_cwd(const char *path);
extern bool path_is_prefix_of_path(const char *path1, const char *path2);
extern char *make_absolute_path(const char *path);
extern const char *get_progname(const char *argv0);
extern void get_share_path(const char *my_exec_path, char *ret_path);
extern void get_etc_path(const char *my_exec_path, char *ret_path);
extern void get_include_path(const char *my_exec_path, char *ret_path);
extern void get_pkginclude_path(const char *my_exec_path, char *ret_path);
extern void get_includeserver_path(const char *my_exec_path, char *ret_path);
extern void get_lib_path(const char *my_exec_path, char *ret_path);
extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
extern void get_locale_path(const char *my_exec_path, char *ret_path);
extern void get_doc_path(const char *my_exec_path, char *ret_path);
extern void get_html_path(const char *my_exec_path, char *ret_path);
extern void get_man_path(const char *my_exec_path, char *ret_path);
extern bool get_home_path(char *ret_path);
extern void get_parent_directory(char *path);
/* common/pgfnames.c */
extern char **pgfnames(const char *path);
extern void pgfnames_cleanup(char **filenames);
/*
* is_absolute_path
*
* By making this a macro we avoid needing to include path.c in libpq.
*/
#ifndef WIN32
#define IS_DIR_SEP(ch) ((ch) == '/')
#define is_absolute_path(filename) \
( \
IS_DIR_SEP((filename)[0]) \
)
#else
# 82 "../../../../src/include/port.h"
#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
/* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */
#define is_absolute_path(filename) \
( \
IS_DIR_SEP((filename)[0]) || \
(isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
IS_DIR_SEP((filename)[2])) \
)
#endif
# 92 "../../../../src/include/port.h"
/* Portable locale initialization (in exec.c) */
extern void set_pglocale_pgservice(const char *argv0, const char *app);
/* Portable way to find binaries (in exec.c) */
extern int find_my_exec(const char *argv0, char *retpath);
extern int find_other_exec(const char *argv0, const char *target,
const char *versionstr, char *retpath);
/* Windows security token manipulation (in exec.c) */
#ifdef WIN32
extern BOOL AddUserToTokenDacl(HANDLE hToken);
#endif
# 105 "../../../../src/include/port.h"
#if defined(WIN32) || defined(__CYGWIN__)
#define EXE ".exe"
#else
# 110 "../../../../src/include/port.h"
#define EXE ""
#endif
# 112 "../../../../src/include/port.h"
#if defined(WIN32) && !defined(__CYGWIN__)
#define DEVNULL "nul"
#else
# 116 "../../../../src/include/port.h"
#define DEVNULL "/dev/null"
#endif
# 118 "../../../../src/include/port.h"
/* Portable delay handling */
extern void pg_usleep(long microsec);
/* Portable SQL-like case-independent comparisons and conversions */
extern int pg_strcasecmp(const char *s1, const char *s2);
extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
extern unsigned char pg_toupper(unsigned char ch);
extern unsigned char pg_tolower(unsigned char ch);
extern unsigned char pg_ascii_toupper(unsigned char ch);
extern unsigned char pg_ascii_tolower(unsigned char ch);
#ifdef USE_REPL_SNPRINTF
#ifdef __CHERI_PURE_CAPABILITY__
#error "MUST NOT USE_REPL_SNPRINTF for CHERIABI"
#endif
# 134 "../../../../src/include/port.h"
/*
* Versions of libintl >= 0.13 try to replace printf() and friends with
* macros to their own versions that understand the %$ format. We do the
* same, so disable their macros, if they exist.
*/
#ifdef vsnprintf
#undef vsnprintf
#endif
# 143 "../../../../src/include/port.h"
#ifdef snprintf
#undef snprintf
#endif
# 146 "../../../../src/include/port.h"
#ifdef sprintf
#undef sprintf
#endif
# 149 "../../../../src/include/port.h"
#ifdef vfprintf
#undef vfprintf
#endif
# 152 "../../../../src/include/port.h"
#ifdef fprintf
#undef fprintf
#endif
# 155 "../../../../src/include/port.h"
#ifdef printf
#undef printf
#endif
# 158 "../../../../src/include/port.h"
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
/*
* The GCC-specific code below prevents the pg_attribute_printf above from
* being replaced, and this is required because gcc doesn't know anything
* about pg_printf.
*/
#ifdef __GNUC__
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
#define snprintf(...) pg_snprintf(__VA_ARGS__)
#define sprintf(...) pg_sprintf(__VA_ARGS__)
#define vfprintf(...) pg_vfprintf(__VA_ARGS__)
#define fprintf(...) pg_fprintf(__VA_ARGS__)
#define printf(...) pg_printf(__VA_ARGS__)
#else
# 179 "../../../../src/include/port.h"
#define vsnprintf pg_vsnprintf
#define snprintf pg_snprintf
#define sprintf pg_sprintf
#define vfprintf pg_vfprintf
#define fprintf pg_fprintf
#define printf pg_printf
#endif
# 186 "../../../../src/include/port.h"
#endif /* USE_REPL_SNPRINTF */
# 187 "../../../../src/include/port.h"
#if defined(WIN32)
/*
* Versions of libintl >= 0.18? try to replace setlocale() with a macro
* to their own versions. Remove the macro, if it exists, because it
* ends up calling the wrong version when the backend and libintl use
* different versions of msvcrt.
*/
#if defined(setlocale)
#undef setlocale
#endif
# 198 "../../../../src/include/port.h"
/*
* Define our own wrapper macro around setlocale() to work around bugs in
* Windows' native setlocale() function.
*/
extern char *pgwin32_setlocale(int category, const char *locale);
#define setlocale(a,b) pgwin32_setlocale(a,b)
#endif /* WIN32 */
# 207 "../../../../src/include/port.h"
/* Portable prompt handling */
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
#ifdef WIN32
#define PG_SIGNAL_COUNT 32
#define kill(pid,sig) pgkill(pid,sig)
extern int pgkill(int pid, int sig);
#endif
# 216 "../../../../src/include/port.h"
extern int pclose_check(FILE *stream);
/* Global variable holding time zone information. */
#if defined(WIN32) || defined(__CYGWIN__)
#define TIMEZONE_GLOBAL _timezone
#define TZNAME_GLOBAL _tzname
#else
# 224 "../../../../src/include/port.h"
#define TIMEZONE_GLOBAL timezone
#define TZNAME_GLOBAL tzname
#endif
# 227 "../../../../src/include/port.h"
#if defined(WIN32) || defined(__CYGWIN__)
/*
* Win32 doesn't have reliable rename/unlink during concurrent access.
*/
extern int pgrename(const char *from, const char *to);
extern int pgunlink(const char *path);
/* Include this first so later includes don't see these defines */
#ifdef WIN32_ONLY_COMPILER
#if 0 /* expanded by -frewrite-includes */
#include <io.h>
#endif /* expanded by -frewrite-includes */
# 237 "../../../../src/include/port.h"
# 238 "../../../../src/include/port.h"
#endif
# 239 "../../../../src/include/port.h"
#define rename(from, to) pgrename(from, to)
#define unlink(path) pgunlink(path)
#endif /* defined(WIN32) || defined(__CYGWIN__) */
# 243 "../../../../src/include/port.h"
/*
* Win32 also doesn't have symlinks, but we can emulate them with
* junction points on newer Win32 versions.
*
* Cygwin has its own symlinks which work on Win95/98/ME where
* junction points don't, so use those instead. We have no way of
* knowing what type of system Cygwin binaries will be run on.
* Note: Some CYGWIN includes might #define WIN32.
*/
#if defined(WIN32) && !defined(__CYGWIN__)
extern int pgsymlink(const char *oldpath, const char *newpath);
extern int pgreadlink(const char *path, char *buf, size_t size);
extern bool pgwin32_is_junction(char *path);
#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
#define readlink(path, buf, size) pgreadlink(path, buf, size)
#endif
# 261 "../../../../src/include/port.h"
extern bool rmtree(const char *path, bool rmtopdir);
/*
* stat() is not guaranteed to set the st_size field on win32, so we
* redefine it to our own implementation that is.
*
* We must pull in sys/stat.h here so the system header definition
* goes in first, and we redefine that, and not the other way around.
*
* Some frontends don't need the size from stat, so if UNSAFE_STAT_OK
* is defined we don't bother with this.
*/
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
#if 0 /* expanded by -frewrite-includes */
#include <sys/stat.h>
#endif /* expanded by -frewrite-includes */
# 275 "../../../../src/include/port.h"
# 276 "../../../../src/include/port.h"
extern int pgwin32_safestat(const char *path, struct stat * buf);
#define stat(a,b) pgwin32_safestat(a,b)
#endif
# 280 "../../../../src/include/port.h"
#if defined(WIN32) && !defined(__CYGWIN__)
/*
* open() and fopen() replacements to allow deletion of open files and
* passing of other special options.
*/
#define O_DIRECT 0x80000000
extern int pgwin32_open(const char *, int,...);
extern FILE *pgwin32_fopen(const char *, const char *);
#ifndef FRONTEND
#define open(a,b,c) pgwin32_open(a,b,c)
#define fopen(a,b) pgwin32_fopen(a,b)
#endif
# 295 "../../../../src/include/port.h"
/*
* Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want
* to use our popen wrapper, rather than plain _popen, so override that. For
* consistency, use our version of pclose, too.
*/
#ifdef popen
#undef popen
#endif
# 304 "../../../../src/include/port.h"
#ifdef pclose
#undef pclose
#endif
# 307 "../../../../src/include/port.h"
/*
* system() and popen() replacements to enclose the command in an extra
* pair of quotes.
*/
extern int pgwin32_system(const char *command);
extern FILE *pgwin32_popen(const char *command, const char *type);
#define system(a) pgwin32_system(a)
#define popen(a,b) pgwin32_popen(a,b)
#define pclose(a) _pclose(a)
/* New versions of MingW have gettimeofday, old mingw and msvc don't */
#ifndef HAVE_GETTIMEOFDAY
/* Last parameter not used */
extern int gettimeofday(struct timeval * tp, struct timezone * tzp);
#endif
# 324 "../../../../src/include/port.h"
#else /* !WIN32 */
# 325 "../../../../src/include/port.h"
/*
* Win32 requires a special close for sockets and pipes, while on Unix
* close() does them all.
*/
#define closesocket close
#endif /* WIN32 */
# 332 "../../../../src/include/port.h"
/*
* On Windows, setvbuf() does not support _IOLBF mode, and interprets that
* as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0)
* crashes outright if "parameter validation" is enabled. Therefore, in
* places where we'd like to select line-buffered mode, we fall back to
* unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF
* directly in order to implement this behavior.
*/
#ifndef WIN32
#define PG_IOLBF _IOLBF
#else
# 344 "../../../../src/include/port.h"
#define PG_IOLBF _IONBF
#endif
# 346 "../../../../src/include/port.h"
/*
* Default "extern" declarations or macro substitutes for library routines.
* When necessary, these routines are provided by files in src/port/.
*/
#ifndef HAVE_CRYPT
extern char *crypt(const char *key, const char *setting);
#endif
# 354 "../../../../src/include/port.h"
/* WIN32 handled in port/win32.h */
#ifndef WIN32
#define pgoff_t off_t
#ifdef __NetBSD__
extern int fseeko(FILE *stream, off_t offset, int whence);
extern off_t ftello(FILE *stream);
#endif
# 362 "../../../../src/include/port.h"
#endif
# 363 "../../../../src/include/port.h"
extern double pg_erand48(unsigned short xseed[3]);
extern long pg_lrand48(void);
extern void pg_srand48(long seed);
#ifndef HAVE_FLS
extern int fls(int mask);
#endif
# 371 "../../../../src/include/port.h"
#ifndef HAVE_FSEEKO
#define fseeko(a, b, c) fseek(a, b, c)
#define ftello(a) ftell(a)
#endif
# 376 "../../../../src/include/port.h"
#if !defined(HAVE_GETPEEREID) && !defined(WIN32)
extern int getpeereid(int sock, uid_t *uid, gid_t *gid);
#endif
# 380 "../../../../src/include/port.h"
#ifndef HAVE_ISINF
extern int isinf(double x);
#endif
# 384 "../../../../src/include/port.h"
#ifndef HAVE_MKDTEMP
extern char *mkdtemp(char *path);
#endif
# 388 "../../../../src/include/port.h"
#ifndef HAVE_RINT
extern double rint(double x);
#endif
# 392 "../../../../src/include/port.h"
#ifndef HAVE_INET_ATON
#if 0 /* expanded by -frewrite-includes */
#include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 394 "../../../../src/include/port.h"
# 395 "../../../../src/include/port.h"
#if 0 /* expanded by -frewrite-includes */
#include <arpa/inet.h>
#endif /* expanded by -frewrite-includes */
# 395 "../../../../src/include/port.h"
# 396 "../../../../src/include/port.h"
extern int inet_aton(const char *cp, struct in_addr * addr);
#endif
# 398 "../../../../src/include/port.h"
#if !HAVE_DECL_STRLCAT
extern size_t strlcat(char *dst, const char *src, size_t siz);
#endif
# 402 "../../../../src/include/port.h"
#if !HAVE_DECL_STRLCPY
extern size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
# 406 "../../../../src/include/port.h"
#if !defined(HAVE_RANDOM) && !defined(__BORLANDC__)
extern long random(void);
#endif
# 410 "../../../../src/include/port.h"
#ifndef HAVE_UNSETENV
extern void unsetenv(const char *name);
#endif
# 414 "../../../../src/include/port.h"
#ifndef HAVE_SRANDOM
extern void srandom(unsigned int seed);
#endif
# 418 "../../../../src/include/port.h"
#ifndef HAVE_SSL_GET_CURRENT_COMPRESSION
#define SSL_get_current_compression(x) 0
#endif
# 422 "../../../../src/include/port.h"
/* thread.h */
extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
#ifndef WIN32
extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
size_t buflen, struct passwd ** result);
#endif
# 430 "../../../../src/include/port.h"
extern int pqGethostbyname(const char *name,
struct hostent * resultbuf,
char *buffer, size_t buflen,
struct hostent ** result,
int *herrno);
extern void pg_qsort(void *base, size_t nel, size_t elsize,
int (*cmp) (const void *, const void *));
/* Use ifdef FreeBSD and not __CHERI_PURE_CAPABILITY__ so that we use the same code path for MIPS and CHERI */
#ifdef __FreeBSD__
/* Postgres qsort_arg is broken for capabilities so we replace it with qsort_r but that uses a different parameter order for cmp */
typedef int (*qsort_arg_comparator) (void *arg, const void *a, const void *b);
/*
* XXXAR: the postgres version of qsort_arg does not work with capabilities (swap
* is broken) so we have to make sure to use the libc function qsort_r instead
*/
static inline void
qsort_arg(void *a, size_t n, size_t es, qsort_arg_comparator cmp, void *arg)
{
qsort_r(a, n, es, arg, cmp);
}
#define QSORT_ARG_COMPARATOR_FUNC(name, a, b) \
int name(void *arg, const void *a, const void *b)
#else
# 456 "../../../../src/include/port.h"
#warning "Using postgres qsort"
#define qsort(a,b,c,d) pg_qsort(a,b,c,d)
typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg);
extern void qsort_arg(void *base, size_t nel, size_t elsize,
qsort_arg_comparator cmp, void *arg);
#endif
# 462 "../../../../src/include/port.h"
extern int pg_qsort_strcmp(const void *a, const void *b);
/* port/chklocale.c */
extern int pg_get_encoding_from_locale(const char *ctype, bool write_message);
#if defined(WIN32) && !defined(FRONTEND)
extern int pg_codepage_to_encoding(UINT cp);
#endif
# 472 "../../../../src/include/port.h"
/* port/inet_net_ntop.c */
extern char *inet_net_ntop(int af, const void *src, int bits,
char *dst, size_t size);
/* port/pgcheckdir.c */
extern int pg_check_dir(const char *dir);
/* port/pgmkdirp.c */
extern int pg_mkdir_p(char *path, int omode);
/* port/pqsignal.c */
typedef void (*pqsigfunc) (int signo);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
/* port/quotes.c */
extern char *escape_single_quotes_ascii(const char *src);
/* port/wait_error.c */
extern char *wait_result_to_str(int exit_status);
#endif /* PG_PORT_H */
# 494 "../../../../src/include/port.h"
# 1120 "../../../../src/include/c.h" 2
#endif /* C_H */
# 1122 "../../../../src/include/c.h"
# 48 "../../../../src/include/postgres.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/elog.h"
#endif /* expanded by -frewrite-includes */
# 48 "../../../../src/include/postgres.h"
# 1 "../../../../src/include/utils/elog.h" 1
/*-------------------------------------------------------------------------
*
* elog.h
* POSTGRES error reporting/logging definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/elog.h
*
*-------------------------------------------------------------------------
*/
#ifndef ELOG_H
#define ELOG_H
#if 0 /* expanded by -frewrite-includes */
#include <setjmp.h>
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/utils/elog.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)setjmp.h 8.2 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _SETJMP_H_
#define _SETJMP_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
/* The size of the jmp_buf is machine dependent: */
#if 0 /* expanded by -frewrite-includes */
#include <machine/setjmp.h>
#endif /* expanded by -frewrite-includes */
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 1 3 4
/* From: NetBSD: setjmp.h,v 1.2 1997/04/06 08:47:41 cgd Exp */
/*-
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* JNPR: setjmp.h,v 1.2 2006/12/02 09:53:41 katta
* $FreeBSD$
*/
#ifndef _MACHINE_SETJMP_H_
#define _MACHINE_SETJMP_H_
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#define _JBLEN 95 /* size, in longs (or long longs), of a jmp_buf */
/*
* jmp_buf and sigjmp_buf are encapsulated in different structs to force
* compile-time diagnostics for mismatches. The structs are the same
* internally to avoid some run-time errors for mismatches.
*/
#ifndef _LOCORE
#ifndef __ASSEMBLER__
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
#ifdef __mips_n32
typedef struct _sigjmp_buf { long long _sjb[_JBLEN + 1]; } sigjmp_buf[1];
#else
# 55 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1];
#endif
# 57 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#endif
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#ifdef __mips_n32
typedef struct _jmp_buf { long long _jb[_JBLEN + 1]; } jmp_buf[1];
#else
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1];
#endif
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#endif /* __ASSEMBLER__ */
# 65 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#endif /* _LOCORE */
# 66 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
#endif /* _MACHINE_SETJMP_H_ */
# 68 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/setjmp.h" 3 4
# 45 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 2 3 4
__BEGIN_DECLS
#if __XSI_VISIBLE >= 600
void _longjmp(jmp_buf, int) __dead2;
int _setjmp(jmp_buf) __returns_twice;
#endif
# 51 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
void longjmp(jmp_buf, int) __dead2;
#if __BSD_VISIBLE
void longjmperror(void);
#endif
# 55 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
int setjmp(jmp_buf) __returns_twice;
#if __POSIX_VISIBLE || __XSI_VISIBLE
void siglongjmp(sigjmp_buf, int) __dead2;
int sigsetjmp(sigjmp_buf, int) __returns_twice;
#endif
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
__END_DECLS
#endif /* !_SETJMP_H_ */
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/setjmp.h" 3 4
# 18 "../../../../src/include/utils/elog.h" 2
/* Error level codes */
#define DEBUG5 10 /* Debugging messages, in categories of
* decreasing detail. */
#define DEBUG4 11
#define DEBUG3 12
#define DEBUG2 13
#define DEBUG1 14 /* used by GUC debug_* variables */
#define LOG 15 /* Server operational messages; sent only to
* server log by default. */
#define LOG_SERVER_ONLY 16 /* Same as LOG for server reporting, but never
* sent to client. */
#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same
* as LOG for server reporting, but
* never sent to client. */
#define INFO 17 /* Messages specifically requested by user (eg
* VACUUM VERBOSE output); always sent to
* client regardless of client_min_messages,
* but by default not sent to server log. */
#define NOTICE 18 /* Helpful messages to users about query
* operation; sent to client and not to server
* log by default. */
#define WARNING 19 /* Warnings. NOTICE is for expected messages
* like implicit sequence creation by SERIAL.
* WARNING is for unexpected messages. */
#define ERROR 20 /* user error - abort transaction; return to
* known state */
/* Save ERROR value in PGERROR so it can be restored when Win32 includes
* modify it. We have to use a constant rather than ERROR because macros
* are expanded only when referenced outside macros.
*/
#ifdef WIN32
#define PGERROR 20
#endif
# 52 "../../../../src/include/utils/elog.h"
#define FATAL 21 /* fatal error - abort process */
#define PANIC 22 /* take down the other backends with me */
/* #define DEBUG DEBUG1 */ /* Backward compatibility with pre-7.3 */
/* macros for representing SQLSTATE strings compactly */
#define PGSIXBIT(ch) (((ch) - '0') & 0x3F)
#define PGUNSIXBIT(val) (((val) & 0x3F) + '0')
#define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \
(PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \
(PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24))
/* These macros depend on the fact that '0' becomes a zero in SIXBIT */
#define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1))
#define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0)
/* SQLSTATE codes for errors are defined in a separate file */
#if 0 /* expanded by -frewrite-includes */
#include "utils/errcodes.h"
#endif /* expanded by -frewrite-includes */
# 71 "../../../../src/include/utils/elog.h"
# 1 "../../../../src/include/utils/errcodes.h" 1
/* autogenerated from src/backend/utils/errcodes.txt, do not edit */
/* there is deliberately not an #ifndef ERRCODES_H here */
/* Class 00 - Successful Completion */
#define ERRCODE_SUCCESSFUL_COMPLETION MAKE_SQLSTATE('0','0','0','0','0')
/* Class 01 - Warning */
#define ERRCODE_WARNING MAKE_SQLSTATE('0','1','0','0','0')
#define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','1','0','0','C')
#define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING MAKE_SQLSTATE('0','1','0','0','8')
#define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION MAKE_SQLSTATE('0','1','0','0','3')
#define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED MAKE_SQLSTATE('0','1','0','0','7')
#define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED MAKE_SQLSTATE('0','1','0','0','6')
#define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('0','1','0','0','4')
#define ERRCODE_WARNING_DEPRECATED_FEATURE MAKE_SQLSTATE('0','1','P','0','1')
/* Class 02 - No Data (this is also a warning class per the SQL standard) */
#define ERRCODE_NO_DATA MAKE_SQLSTATE('0','2','0','0','0')
#define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','2','0','0','1')
/* Class 03 - SQL Statement Not Yet Complete */
#define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE MAKE_SQLSTATE('0','3','0','0','0')
/* Class 08 - Connection Exception */
#define ERRCODE_CONNECTION_EXCEPTION MAKE_SQLSTATE('0','8','0','0','0')
#define ERRCODE_CONNECTION_DOES_NOT_EXIST MAKE_SQLSTATE('0','8','0','0','3')
#define ERRCODE_CONNECTION_FAILURE MAKE_SQLSTATE('0','8','0','0','6')
#define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','1')
#define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','4')
#define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN MAKE_SQLSTATE('0','8','0','0','7')
#define ERRCODE_PROTOCOL_VIOLATION MAKE_SQLSTATE('0','8','P','0','1')
/* Class 09 - Triggered Action Exception */
#define ERRCODE_TRIGGERED_ACTION_EXCEPTION MAKE_SQLSTATE('0','9','0','0','0')
/* Class 0A - Feature Not Supported */
#define ERRCODE_FEATURE_NOT_SUPPORTED MAKE_SQLSTATE('0','A','0','0','0')
/* Class 0B - Invalid Transaction Initiation */
#define ERRCODE_INVALID_TRANSACTION_INITIATION MAKE_SQLSTATE('0','B','0','0','0')
/* Class 0F - Locator Exception */
#define ERRCODE_LOCATOR_EXCEPTION MAKE_SQLSTATE('0','F','0','0','0')
#define ERRCODE_L_E_INVALID_SPECIFICATION MAKE_SQLSTATE('0','F','0','0','1')
/* Class 0L - Invalid Grantor */
#define ERRCODE_INVALID_GRANTOR MAKE_SQLSTATE('0','L','0','0','0')
#define ERRCODE_INVALID_GRANT_OPERATION MAKE_SQLSTATE('0','L','P','0','1')
/* Class 0P - Invalid Role Specification */
#define ERRCODE_INVALID_ROLE_SPECIFICATION MAKE_SQLSTATE('0','P','0','0','0')
/* Class 0Z - Diagnostics Exception */
#define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0')
#define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2')
/* Class 20 - Case Not Found */
#define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0')
/* Class 21 - Cardinality Violation */
#define ERRCODE_CARDINALITY_VIOLATION MAKE_SQLSTATE('2','1','0','0','0')
/* Class 22 - Data Exception */
#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2','0','0','0')
#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2','0','2','E')
#define ERRCODE_ARRAY_SUBSCRIPT_ERROR MAKE_SQLSTATE('2','2','0','2','E')
#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2','0','2','1')
#define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','0','8')
#define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','8')
#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2','0','1','2')
#define ERRCODE_ERROR_IN_ASSIGNMENT MAKE_SQLSTATE('2','2','0','0','5')
#define ERRCODE_ESCAPE_CHARACTER_CONFLICT MAKE_SQLSTATE('2','2','0','0','B')
#define ERRCODE_INDICATOR_OVERFLOW MAKE_SQLSTATE('2','2','0','2','2')
#define ERRCODE_INTERVAL_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','1','5')
#define ERRCODE_INVALID_ARGUMENT_FOR_LOG MAKE_SQLSTATE('2','2','0','1','E')
#define ERRCODE_INVALID_ARGUMENT_FOR_NTILE MAKE_SQLSTATE('2','2','0','1','4')
#define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2','0','1','6')
#define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2','0','1','F')
#define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION MAKE_SQLSTATE('2','2','0','1','G')
#define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST MAKE_SQLSTATE('2','2','0','1','8')
#define ERRCODE_INVALID_DATETIME_FORMAT MAKE_SQLSTATE('2','2','0','0','7')
#define ERRCODE_INVALID_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','1','9')
#define ERRCODE_INVALID_ESCAPE_OCTET MAKE_SQLSTATE('2','2','0','0','D')
#define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2','0','2','5')
#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','P','0','6')
#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','1','0')
#define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','2','3')
#define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2','0','1','B')
#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2','2','0','1','W')
#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2','2','0','1','X')
#define ERRCODE_INVALID_TABLESAMPLE_ARGUMENT MAKE_SQLSTATE('2','2','0','2','H')
#define ERRCODE_INVALID_TABLESAMPLE_REPEAT MAKE_SQLSTATE('2','2','0','2','G')
#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2','0','0','9')
#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','0','C')
#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2','0','0','G')
#define ERRCODE_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('2','2','0','0','4')
#define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER MAKE_SQLSTATE('2','2','0','0','2')
#define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','3')
#define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2','0','2','6')
#define ERRCODE_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('2','2','0','0','1')
#define ERRCODE_SUBSTRING_ERROR MAKE_SQLSTATE('2','2','0','1','1')
#define ERRCODE_TRIM_ERROR MAKE_SQLSTATE('2','2','0','2','7')
#define ERRCODE_UNTERMINATED_C_STRING MAKE_SQLSTATE('2','2','0','2','4')
#define ERRCODE_ZERO_LENGTH_CHARACTER_STRING MAKE_SQLSTATE('2','2','0','0','F')
#define ERRCODE_FLOATING_POINT_EXCEPTION MAKE_SQLSTATE('2','2','P','0','1')
#define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','2')
#define ERRCODE_INVALID_BINARY_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','3')
#define ERRCODE_BAD_COPY_FILE_FORMAT MAKE_SQLSTATE('2','2','P','0','4')
#define ERRCODE_UNTRANSLATABLE_CHARACTER MAKE_SQLSTATE('2','2','P','0','5')
#define ERRCODE_NOT_AN_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','L')
#define ERRCODE_INVALID_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','M')
#define ERRCODE_INVALID_XML_CONTENT MAKE_SQLSTATE('2','2','0','0','N')
#define ERRCODE_INVALID_XML_COMMENT MAKE_SQLSTATE('2','2','0','0','S')
#define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION MAKE_SQLSTATE('2','2','0','0','T')
/* Class 23 - Integrity Constraint Violation */
#define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('2','3','0','0','0')
#define ERRCODE_RESTRICT_VIOLATION MAKE_SQLSTATE('2','3','0','0','1')
#define ERRCODE_NOT_NULL_VIOLATION MAKE_SQLSTATE('2','3','5','0','2')
#define ERRCODE_FOREIGN_KEY_VIOLATION MAKE_SQLSTATE('2','3','5','0','3')
#define ERRCODE_UNIQUE_VIOLATION MAKE_SQLSTATE('2','3','5','0','5')
#define ERRCODE_CHECK_VIOLATION MAKE_SQLSTATE('2','3','5','1','4')
#define ERRCODE_EXCLUSION_VIOLATION MAKE_SQLSTATE('2','3','P','0','1')
/* Class 24 - Invalid Cursor State */
#define ERRCODE_INVALID_CURSOR_STATE MAKE_SQLSTATE('2','4','0','0','0')
/* Class 25 - Invalid Transaction State */
#define ERRCODE_INVALID_TRANSACTION_STATE MAKE_SQLSTATE('2','5','0','0','0')
#define ERRCODE_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','1')
#define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE MAKE_SQLSTATE('2','5','0','0','2')
#define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL MAKE_SQLSTATE('2','5','0','0','8')
#define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','3')
#define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','4')
#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','5')
#define ERRCODE_READ_ONLY_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','6')
#define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5','0','0','7')
#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1')
#define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2')
#define ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','3')
/* Class 26 - Invalid SQL Statement Name */
#define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0')
/* Class 27 - Triggered Data Change Violation */
#define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION MAKE_SQLSTATE('2','7','0','0','0')
/* Class 28 - Invalid Authorization Specification */
#define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8','0','0','0')
#define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8','P','0','1')
/* Class 2B - Dependent Privilege Descriptors Still Exist */
#define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST MAKE_SQLSTATE('2','B','0','0','0')
#define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST MAKE_SQLSTATE('2','B','P','0','1')
/* Class 2D - Invalid Transaction Termination */
#define ERRCODE_INVALID_TRANSACTION_TERMINATION MAKE_SQLSTATE('2','D','0','0','0')
/* Class 2F - SQL Routine Exception */
#define ERRCODE_SQL_ROUTINE_EXCEPTION MAKE_SQLSTATE('2','F','0','0','0')
#define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F','0','0','5')
#define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','2')
#define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('2','F','0','0','3')
#define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','4')
/* Class 34 - Invalid Cursor Name */
#define ERRCODE_INVALID_CURSOR_NAME MAKE_SQLSTATE('3','4','0','0','0')
/* Class 38 - External Routine Exception */
#define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION MAKE_SQLSTATE('3','8','0','0','0')
#define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','1')
#define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','2')
#define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('3','8','0','0','3')
#define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','4')
/* Class 39 - External Routine Invocation Exception */
#define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION MAKE_SQLSTATE('3','9','0','0','0')
#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9','0','0','1')
#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9','0','0','4')
#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','1')
#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','2')
#define ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','3')
/* Class 3B - Savepoint Exception */
#define ERRCODE_SAVEPOINT_EXCEPTION MAKE_SQLSTATE('3','B','0','0','0')
#define ERRCODE_S_E_INVALID_SPECIFICATION MAKE_SQLSTATE('3','B','0','0','1')
/* Class 3D - Invalid Catalog Name */
#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D','0','0','0')
/* Class 3F - Invalid Schema Name */
#define ERRCODE_INVALID_SCHEMA_NAME MAKE_SQLSTATE('3','F','0','0','0')
/* Class 40 - Transaction Rollback */
#define ERRCODE_TRANSACTION_ROLLBACK MAKE_SQLSTATE('4','0','0','0','0')
#define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('4','0','0','0','2')
#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0','0','0','1')
#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0','0','0','3')
#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0','P','0','1')
/* Class 42 - Syntax Error or Access Rule Violation */
#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2','0','0','0')
#define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2','6','0','1')
#define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2','5','0','1')
#define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2','8','4','6')
#define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2','8','0','3')
#define ERRCODE_WINDOWING_ERROR MAKE_SQLSTATE('4','2','P','2','0')
#define ERRCODE_INVALID_RECURSION MAKE_SQLSTATE('4','2','P','1','9')
#define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2','8','3','0')
#define ERRCODE_INVALID_NAME MAKE_SQLSTATE('4','2','6','0','2')
#define ERRCODE_NAME_TOO_LONG MAKE_SQLSTATE('4','2','6','2','2')
#define ERRCODE_RESERVED_NAME MAKE_SQLSTATE('4','2','9','3','9')
#define ERRCODE_DATATYPE_MISMATCH MAKE_SQLSTATE('4','2','8','0','4')
#define ERRCODE_INDETERMINATE_DATATYPE MAKE_SQLSTATE('4','2','P','1','8')
#define ERRCODE_COLLATION_MISMATCH MAKE_SQLSTATE('4','2','P','2','1')
#define ERRCODE_INDETERMINATE_COLLATION MAKE_SQLSTATE('4','2','P','2','2')
#define ERRCODE_WRONG_OBJECT_TYPE MAKE_SQLSTATE('4','2','8','0','9')
#define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2','7','0','3')
#define ERRCODE_UNDEFINED_CURSOR MAKE_SQLSTATE('3','4','0','0','0')
#define ERRCODE_UNDEFINED_DATABASE MAKE_SQLSTATE('3','D','0','0','0')
#define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2','8','8','3')
#define ERRCODE_UNDEFINED_PSTATEMENT MAKE_SQLSTATE('2','6','0','0','0')
#define ERRCODE_UNDEFINED_SCHEMA MAKE_SQLSTATE('3','F','0','0','0')
#define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2','P','0','1')
#define ERRCODE_UNDEFINED_PARAMETER MAKE_SQLSTATE('4','2','P','0','2')
#define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2','7','0','4')
#define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2','7','0','1')
#define ERRCODE_DUPLICATE_CURSOR MAKE_SQLSTATE('4','2','P','0','3')
#define ERRCODE_DUPLICATE_DATABASE MAKE_SQLSTATE('4','2','P','0','4')
#define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2','7','2','3')
#define ERRCODE_DUPLICATE_PSTATEMENT MAKE_SQLSTATE('4','2','P','0','5')
#define ERRCODE_DUPLICATE_SCHEMA MAKE_SQLSTATE('4','2','P','0','6')
#define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2','P','0','7')
#define ERRCODE_DUPLICATE_ALIAS MAKE_SQLSTATE('4','2','7','1','2')
#define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2','7','1','0')
#define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2','7','0','2')
#define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2','7','2','5')
#define ERRCODE_AMBIGUOUS_PARAMETER MAKE_SQLSTATE('4','2','P','0','8')
#define ERRCODE_AMBIGUOUS_ALIAS MAKE_SQLSTATE('4','2','P','0','9')
#define ERRCODE_INVALID_COLUMN_REFERENCE MAKE_SQLSTATE('4','2','P','1','0')
#define ERRCODE_INVALID_COLUMN_DEFINITION MAKE_SQLSTATE('4','2','6','1','1')
#define ERRCODE_INVALID_CURSOR_DEFINITION MAKE_SQLSTATE('4','2','P','1','1')
#define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2','P','1','2')
#define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2','P','1','3')
#define ERRCODE_INVALID_PSTATEMENT_DEFINITION MAKE_SQLSTATE('4','2','P','1','4')
#define ERRCODE_INVALID_SCHEMA_DEFINITION MAKE_SQLSTATE('4','2','P','1','5')
#define ERRCODE_INVALID_TABLE_DEFINITION MAKE_SQLSTATE('4','2','P','1','6')
#define ERRCODE_INVALID_OBJECT_DEFINITION MAKE_SQLSTATE('4','2','P','1','7')
/* Class 44 - WITH CHECK OPTION Violation */
#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4','0','0','0')
/* Class 53 - Insufficient Resources */
#define ERRCODE_INSUFFICIENT_RESOURCES MAKE_SQLSTATE('5','3','0','0','0')
#define ERRCODE_DISK_FULL MAKE_SQLSTATE('5','3','1','0','0')
#define ERRCODE_OUT_OF_MEMORY MAKE_SQLSTATE('5','3','2','0','0')
#define ERRCODE_TOO_MANY_CONNECTIONS MAKE_SQLSTATE('5','3','3','0','0')
#define ERRCODE_CONFIGURATION_LIMIT_EXCEEDED MAKE_SQLSTATE('5','3','4','0','0')
/* Class 54 - Program Limit Exceeded */
#define ERRCODE_PROGRAM_LIMIT_EXCEEDED MAKE_SQLSTATE('5','4','0','0','0')
#define ERRCODE_STATEMENT_TOO_COMPLEX MAKE_SQLSTATE('5','4','0','0','1')
#define ERRCODE_TOO_MANY_COLUMNS MAKE_SQLSTATE('5','4','0','1','1')
#define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('5','4','0','2','3')
/* Class 55 - Object Not In Prerequisite State */
#define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE MAKE_SQLSTATE('5','5','0','0','0')
#define ERRCODE_OBJECT_IN_USE MAKE_SQLSTATE('5','5','0','0','6')
#define ERRCODE_CANT_CHANGE_RUNTIME_PARAM MAKE_SQLSTATE('5','5','P','0','2')
#define ERRCODE_LOCK_NOT_AVAILABLE MAKE_SQLSTATE('5','5','P','0','3')
/* Class 57 - Operator Intervention */
#define ERRCODE_OPERATOR_INTERVENTION MAKE_SQLSTATE('5','7','0','0','0')
#define ERRCODE_QUERY_CANCELED MAKE_SQLSTATE('5','7','0','1','4')
#define ERRCODE_ADMIN_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','1')
#define ERRCODE_CRASH_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','2')
#define ERRCODE_CANNOT_CONNECT_NOW MAKE_SQLSTATE('5','7','P','0','3')
#define ERRCODE_DATABASE_DROPPED MAKE_SQLSTATE('5','7','P','0','4')
/* Class 58 - System Error (errors external to PostgreSQL itself) */
#define ERRCODE_SYSTEM_ERROR MAKE_SQLSTATE('5','8','0','0','0')
#define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0')
#define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1')
#define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2')
/* Class 72 - Snapshot Failure */
#define ERRCODE_SNAPSHOT_TOO_OLD MAKE_SQLSTATE('7','2','0','0','0')
/* Class F0 - Configuration File Error */
#define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0')
#define ERRCODE_LOCK_FILE_EXISTS MAKE_SQLSTATE('F','0','0','0','1')
/* Class HV - Foreign Data Wrapper Error (SQL/MED) */
#define ERRCODE_FDW_ERROR MAKE_SQLSTATE('H','V','0','0','0')
#define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','5')
#define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED MAKE_SQLSTATE('H','V','0','0','2')
#define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR MAKE_SQLSTATE('H','V','0','1','0')
#define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION MAKE_SQLSTATE('H','V','0','2','1')
#define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE MAKE_SQLSTATE('H','V','0','2','4')
#define ERRCODE_FDW_INVALID_COLUMN_NAME MAKE_SQLSTATE('H','V','0','0','7')
#define ERRCODE_FDW_INVALID_COLUMN_NUMBER MAKE_SQLSTATE('H','V','0','0','8')
#define ERRCODE_FDW_INVALID_DATA_TYPE MAKE_SQLSTATE('H','V','0','0','4')
#define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS MAKE_SQLSTATE('H','V','0','0','6')
#define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER MAKE_SQLSTATE('H','V','0','9','1')
#define ERRCODE_FDW_INVALID_HANDLE MAKE_SQLSTATE('H','V','0','0','B')
#define ERRCODE_FDW_INVALID_OPTION_INDEX MAKE_SQLSTATE('H','V','0','0','C')
#define ERRCODE_FDW_INVALID_OPTION_NAME MAKE_SQLSTATE('H','V','0','0','D')
#define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH MAKE_SQLSTATE('H','V','0','9','0')
#define ERRCODE_FDW_INVALID_STRING_FORMAT MAKE_SQLSTATE('H','V','0','0','A')
#define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER MAKE_SQLSTATE('H','V','0','0','9')
#define ERRCODE_FDW_TOO_MANY_HANDLES MAKE_SQLSTATE('H','V','0','1','4')
#define ERRCODE_FDW_OUT_OF_MEMORY MAKE_SQLSTATE('H','V','0','0','1')
#define ERRCODE_FDW_NO_SCHEMAS MAKE_SQLSTATE('H','V','0','0','P')
#define ERRCODE_FDW_OPTION_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','J')
#define ERRCODE_FDW_REPLY_HANDLE MAKE_SQLSTATE('H','V','0','0','K')
#define ERRCODE_FDW_SCHEMA_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','Q')
#define ERRCODE_FDW_TABLE_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','R')
#define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V','0','0','L')
#define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY MAKE_SQLSTATE('H','V','0','0','M')
#define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION MAKE_SQLSTATE('H','V','0','0','N')
/* Class P0 - PL/pgSQL Error */
#define ERRCODE_PLPGSQL_ERROR MAKE_SQLSTATE('P','0','0','0','0')
#define ERRCODE_RAISE_EXCEPTION MAKE_SQLSTATE('P','0','0','0','1')
#define ERRCODE_NO_DATA_FOUND MAKE_SQLSTATE('P','0','0','0','2')
#define ERRCODE_TOO_MANY_ROWS MAKE_SQLSTATE('P','0','0','0','3')
#define ERRCODE_ASSERT_FAILURE MAKE_SQLSTATE('P','0','0','0','4')
/* Class XX - Internal Error */
#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0')
#define ERRCODE_DATA_CORRUPTED MAKE_SQLSTATE('X','X','0','0','1')
#define ERRCODE_INDEX_CORRUPTED MAKE_SQLSTATE('X','X','0','0','2')
# 72 "../../../../src/include/utils/elog.h" 2
/*----------
* New-style error reporting API: to be used in this way:
* ereport(ERROR,
* (errcode(ERRCODE_UNDEFINED_CURSOR),
* errmsg("portal \"%s\" not found", stmt->portalname),
* ... other errxxx() fields as needed ...));
*
* The error level is required, and so is a primary error message (errmsg
* or errmsg_internal). All else is optional. errcode() defaults to
* ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING
* if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is
* NOTICE or below.
*
* ereport_domain() allows a message domain to be specified, for modules that
* wish to use a different message catalog from the backend's. To avoid having
* one copy of the default text domain per .o file, we define it as NULL here
* and have errstart insert the default text domain. Modules can either use
* ereport_domain() directly, or preferably they can override the TEXTDOMAIN
* macro.
*
* If elevel >= ERROR, the call will not return; we try to inform the compiler
* of that via pg_unreachable(). However, no useful optimization effect is
* obtained unless the compiler sees elevel as a compile-time constant, else
* we're just adding code bloat. So, if __builtin_constant_p is available,
* use that to cause the second if() to vanish completely for non-constant
* cases. We avoid using a local variable because it's not necessary and
* prevents gcc from making the unreachability deduction at optlevel -O0.
*----------
*/
#ifdef HAVE__BUILTIN_CONSTANT_P
#define ereport_domain(elevel, domain, rest) \
do { \
if (errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain)) \
errfinish rest; \
if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
pg_unreachable(); \
} while(0)
#else /* !HAVE__BUILTIN_CONSTANT_P */
# 112 "../../../../src/include/utils/elog.h"
#define ereport_domain(elevel, domain, rest) \
do { \
const int elevel_ = (elevel); \
if (errstart(elevel_, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain)) \
errfinish rest; \
if (elevel_ >= ERROR) \
pg_unreachable(); \
} while(0)
#endif /* HAVE__BUILTIN_CONSTANT_P */
# 121 "../../../../src/include/utils/elog.h"
#define ereport(elevel, rest) \
ereport_domain(elevel, TEXTDOMAIN, rest)
#define TEXTDOMAIN NULL
extern bool errstart(int elevel, const char *filename, int lineno,
const char *funcname, const char *domain);
extern void errfinish(int dummy,...);
extern int errcode(int sqlerrcode);
extern int errcode_for_file_access(void);
extern int errcode_for_socket_access(void);
extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural,
unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errdetail_log_plural(const char *fmt_singular,
const char *fmt_plural,
unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural,
unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2);
/*
* errcontext() is typically called in error context callback functions, not
* within an ereport() invocation. The callback function can be in a different
* module than the ereport() call, so the message domain passed in errstart()
* is not usually the correct domain for translating the context message.
* set_errcontext_domain() first sets the domain to be used, and
* errcontext_msg() passes the actual message.
*/
#define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg
extern int set_errcontext_domain(const char *domain);
extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errhidestmt(bool hide_stmt);
extern int errhidecontext(bool hide_ctx);
extern int errfunction(const char *funcname);
extern int errposition(int cursorpos);
extern int internalerrposition(int cursorpos);
extern int internalerrquery(const char *query);
extern int err_generic_string(int field, const char *str);
extern int geterrcode(void);
extern int geterrposition(void);
extern int getinternalerrposition(void);
/*----------
* Old-style error reporting API: to be used in this way:
* elog(ERROR, "portal \"%s\" not found", stmt->portalname);
*----------
*/
#ifdef HAVE__VA_ARGS
/*
* If we have variadic macros, we can give the compiler a hint about the
* call not returning when elevel >= ERROR. See comments for ereport().
* Note that historically elog() has called elog_start (which saves errno)
* before evaluating "elevel", so we preserve that behavior here.
*/
#ifdef HAVE__BUILTIN_CONSTANT_P
#define elog(elevel, ...) \
do { \
elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
elog_finish(elevel, __VA_ARGS__); \
if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
pg_unreachable(); \
} while(0)
#else /* !HAVE__BUILTIN_CONSTANT_P */
# 207 "../../../../src/include/utils/elog.h"
#define elog(elevel, ...) \
do { \
elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
{ \
const int elevel_ = (elevel); \
elog_finish(elevel_, __VA_ARGS__); \
if (elevel_ >= ERROR) \
pg_unreachable(); \
} \
} while(0)
#endif /* HAVE__BUILTIN_CONSTANT_P */
# 218 "../../../../src/include/utils/elog.h"
#else /* !HAVE__VA_ARGS */
# 219 "../../../../src/include/utils/elog.h"
#define elog \
elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO), \
elog_finish
#endif /* HAVE__VA_ARGS */
# 223 "../../../../src/include/utils/elog.h"
extern void elog_start(const char *filename, int lineno, const char *funcname);
extern void elog_finish(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);
/* Support for constructing error strings separately from ereport() calls */
extern void pre_format_elog_string(int errnumber, const char *domain);
extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2);
/* Support for attaching context information to error reports */
typedef struct ErrorContextCallback
{
struct ErrorContextCallback *previous;
void (*callback) (void *arg);
void *arg;
} ErrorContextCallback;
extern PGDLLIMPORT ErrorContextCallback *error_context_stack;
/*----------
* API for catching ereport(ERROR) exits. Use these macros like so:
*
* PG_TRY();
* {
* ... code that might throw ereport(ERROR) ...
* }
* PG_CATCH();
* {
* ... error recovery code ...
* }
* PG_END_TRY();
*
* (The braces are not actually necessary, but are recommended so that
* pgindent will indent the construct nicely.) The error recovery code
* can optionally do PG_RE_THROW() to propagate the same error outwards.
*
* Note: while the system will correctly propagate any new ereport(ERROR)
* occurring in the recovery section, there is a small limit on the number
* of levels this will work for. It's best to keep the error recovery
* section simple enough that it can't generate any new errors, at least
* not before popping the error stack.
*
* Note: an ereport(FATAL) will not be caught by this construct; control will
* exit straight through proc_exit(). Therefore, do NOT put any cleanup
* of non-process-local resources into the error recovery section, at least
* not without taking thought for what will happen during ereport(FATAL).
* The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be
* helpful in such cases.
*
* Note: if a local variable of the function containing PG_TRY is modified
* in the PG_TRY section and used in the PG_CATCH section, that variable
* must be declared "volatile" for POSIX compliance. This is not mere
* pedantry; we have seen bugs from compilers improperly optimizing code
* away when such a variable was not marked. Beware that gcc's -Wclobbered
* warnings are just about entirely useless for catching such oversights.
*----------
*/
#define PG_TRY() \
do { \
sigjmp_buf *save_exception_stack = PG_exception_stack; \
ErrorContextCallback *save_context_stack = error_context_stack; \
sigjmp_buf local_sigjmp_buf; \
if (sigsetjmp(local_sigjmp_buf, 0) == 0) \
{ \
PG_exception_stack = &local_sigjmp_buf
#define PG_CATCH() \
} \
else \
{ \
PG_exception_stack = save_exception_stack; \
error_context_stack = save_context_stack
#define PG_END_TRY() \
} \
PG_exception_stack = save_exception_stack; \
error_context_stack = save_context_stack; \
} while (0)
/*
* Some compilers understand pg_attribute_noreturn(); for other compilers,
* insert pg_unreachable() so that the compiler gets the point.
*/
#ifdef HAVE_PG_ATTRIBUTE_NORETURN
#define PG_RE_THROW() \
pg_re_throw()
#else
# 314 "../../../../src/include/utils/elog.h"
#define PG_RE_THROW() \
(pg_re_throw(), pg_unreachable())
#endif
# 317 "../../../../src/include/utils/elog.h"
extern PGDLLIMPORT sigjmp_buf *PG_exception_stack;
/* Stuff that error handlers might want to use */
/*
* ErrorData holds the data accumulated during any one ereport() cycle.
* Any non-NULL pointers must point to palloc'd data.
* (The const pointers are an exception; we assume they point at non-freeable
* constant strings.)
*/
typedef struct ErrorData
{
int elevel; /* error level */
bool output_to_server; /* will report to server log? */
bool output_to_client; /* will report to client? */
bool show_funcname; /* true to force funcname inclusion */
bool hide_stmt; /* true to prevent STATEMENT: inclusion */
bool hide_ctx; /* true to prevent CONTEXT: inclusion */
const char *filename; /* __FILE__ of ereport() call */
int lineno; /* __LINE__ of ereport() call */
const char *funcname; /* __func__ of ereport() call */
const char *domain; /* message domain */
const char *context_domain; /* message domain for context message */
int sqlerrcode; /* encoded ERRSTATE */
char *message; /* primary error message (translated) */
char *detail; /* detail error message */
char *detail_log; /* detail error message for server log only */
char *hint; /* hint message */
char *context; /* context message */
const char *message_id; /* primary message's id (original string) */
char *schema_name; /* name of schema */
char *table_name; /* name of table */
char *column_name; /* name of column */
char *datatype_name; /* name of datatype */
char *constraint_name; /* name of constraint */
int cursorpos; /* cursor index into query string */
int internalpos; /* cursor index into internalquery */
char *internalquery; /* text of internally-generated query */
int saved_errno; /* errno at entry */
/* context containing associated non-constant strings */
struct MemoryContextData *assoc_context;
} ErrorData;
extern void EmitErrorReport(void);
extern ErrorData *CopyErrorData(void);
extern void FreeErrorData(ErrorData *edata);
extern void FlushErrorState(void);
extern void ReThrowError(ErrorData *edata) pg_attribute_noreturn();
extern void ThrowErrorData(ErrorData *edata);
extern void pg_re_throw(void) pg_attribute_noreturn();
extern char *GetErrorContextStack(void);
/* Hook for intercepting messages before they are sent to the server log */
typedef void (*emit_log_hook_type) (ErrorData *edata);
extern PGDLLIMPORT emit_log_hook_type emit_log_hook;
/* GUC-configurable parameters */
typedef enum
{
PGERROR_TERSE, /* single-line error messages */
PGERROR_DEFAULT, /* recommended style */
PGERROR_VERBOSE /* all the facts, ma'am */
} PGErrorVerbosity;
extern int Log_error_verbosity;
extern char *Log_line_prefix;
extern int Log_destination;
extern char *Log_destination_string;
extern bool syslog_sequence_numbers;
extern bool syslog_split_messages;
/* Log destination bitmap */
#define LOG_DESTINATION_STDERR 1
#define LOG_DESTINATION_SYSLOG 2
#define LOG_DESTINATION_EVENTLOG 4
#define LOG_DESTINATION_CSVLOG 8
/* Other exported functions */
extern void DebugFileOpen(void);
extern char *unpack_sql_state(int sql_state);
extern bool in_error_recursion_trouble(void);
#ifdef HAVE_SYSLOG
extern void set_syslog_parameters(const char *ident, int facility);
#endif
# 408 "../../../../src/include/utils/elog.h"
/*
* Write errors to stderr (or by equal means when stderr is
* not available). Used before ereport/elog can be used
* safely (memory context, GUC load etc)
*/
extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
#endif /* ELOG_H */
# 417 "../../../../src/include/utils/elog.h"
# 49 "../../../../src/include/postgres.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/palloc.h"
#endif /* expanded by -frewrite-includes */
# 49 "../../../../src/include/postgres.h"
# 1 "../../../../src/include/utils/palloc.h" 1
/*-------------------------------------------------------------------------
*
* palloc.h
* POSTGRES memory allocator definitions.
*
* This file contains the basic memory allocation interface that is
* needed by almost every backend module. It is included directly by
* postgres.h, so the definitions here are automatically available
* everywhere. Keep it lean!
*
* Memory allocation occurs within "contexts". Every chunk obtained from
* palloc()/MemoryContextAlloc() is allocated within a specific context.
* The entire contents of a context can be freed easily and quickly by
* resetting or deleting the context --- this is both faster and less
* prone to memory-leakage bugs than releasing chunks individually.
* We organize contexts into context trees to allow fine-grain control
* over chunk lifetime while preserving the certainty that we will free
* everything that should be freed. See utils/mmgr/README for more info.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/palloc.h
*
*-------------------------------------------------------------------------
*/
#ifndef PALLOC_H
#define PALLOC_H
/*
* Type MemoryContextData is declared in nodes/memnodes.h. Most users
* of memory allocation should just treat it as an abstract type, so we
* do not provide the struct contents here.
*/
typedef struct MemoryContextData *MemoryContext;
/*
* A memory context can have callback functions registered on it. Any such
* function will be called once just before the context is next reset or
* deleted. The MemoryContextCallback struct describing such a callback
* typically would be allocated within the context itself, thereby avoiding
* any need to manage it explicitly (the reset/delete action will free it).
*/
typedef void (*MemoryContextCallbackFunction) (void *arg);
typedef struct MemoryContextCallback
{
MemoryContextCallbackFunction func; /* function to call */
void *arg; /* argument to pass it */
struct MemoryContextCallback *next; /* next in list of callbacks */
} MemoryContextCallback;
/*
* CurrentMemoryContext is the default allocation context for palloc().
* Avoid accessing it directly! Instead, use MemoryContextSwitchTo()
* to change the setting.
*/
extern PGDLLIMPORT MemoryContext CurrentMemoryContext;
/*
* Flags for MemoryContextAllocExtended.
*/
#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */
#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */
#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */
/*
* Fundamental memory-allocation operations (more are in utils/memutils.h)
*/
extern void *MemoryContextAlloc(MemoryContext context, Size size);
extern void *MemoryContextAllocZero(MemoryContext context, Size size);
extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size);
extern void *MemoryContextAllocExtended(MemoryContext context,
Size size, int flags);
extern void *palloc(Size size);
extern void *palloc0(Size size);
extern void *palloc_extended(Size size, int flags);
extern void *repalloc(void *pointer, Size size);
extern void pfree(void *pointer);
/*
* The result of palloc() is always word-aligned, so we can skip testing
* alignment of the pointer when deciding which MemSet variant to use.
* Note that this variant does not offer any advantage, and should not be
* used, unless its "sz" argument is a compile-time constant; therefore, the
* issue that it evaluates the argument multiple times isn't a problem in
* practice.
*/
#define palloc0fast(sz) \
( MemSetTest(0, sz) ? \
MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \
MemoryContextAllocZero(CurrentMemoryContext, sz) )
/* Higher-limit allocators. */
extern void *MemoryContextAllocHuge(MemoryContext context, Size size);
extern void *repalloc_huge(void *pointer, Size size);
/*
* Although this header file is nominally backend-only, certain frontend
* programs like pg_controldata include it via postgres.h. For some compilers
* it's necessary to hide the inline definition of MemoryContextSwitchTo in
* this scenario; hence the #ifndef FRONTEND.
*/
#ifndef FRONTEND
static inline MemoryContext
MemoryContextSwitchTo(MemoryContext context)
{
MemoryContext old = CurrentMemoryContext;
CurrentMemoryContext = context;
return old;
}
#endif /* FRONTEND */
# 117 "../../../../src/include/utils/palloc.h"
/* Registration of memory context reset/delete callbacks */
extern void MemoryContextRegisterResetCallback(MemoryContext context,
MemoryContextCallback *cb);
/*
* These are like standard strdup() except the copied string is
* allocated in a context, not with malloc().
*/
extern char *MemoryContextStrdup(MemoryContext context, const char *string);
extern char *pstrdup(const char *in);
extern char *pnstrdup(const char *in, Size len);
/* sprintf into a palloc'd buffer --- these are in psprintf.c */
extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
#endif /* PALLOC_H */
# 135 "../../../../src/include/utils/palloc.h"
# 50 "../../../../src/include/postgres.h" 2
/* ----------------------------------------------------------------
* Section 1: variable-length datatypes (TOAST support)
* ----------------------------------------------------------------
*/
/*
* struct varatt_external is a traditional "TOAST pointer", that is, the
* information needed to fetch a Datum stored out-of-line in a TOAST table.
* The data is compressed if and only if va_extsize < va_rawsize - VARHDRSZ.
* This struct must not contain any padding, because we sometimes compare
* these pointers using memcmp.
*
* Note that this information is stored unaligned within actual tuples, so
* you need to memcpy from the tuple into a local struct variable before
* you can look at these fields! (The reason we use memcmp is to avoid
* having to do that just to detect equality of two TOAST pointers...)
*/
typedef struct varatt_external
{
int32 va_rawsize; /* Original data size (includes header) */
int32 va_extsize; /* External saved size (doesn't) */
Oid va_valueid; /* Unique ID of value within TOAST table */
Oid va_toastrelid; /* RelID of TOAST table containing it */
} varatt_external;
/*
* struct varatt_indirect is a "TOAST pointer" representing an out-of-line
* Datum that's stored in memory, not in an external toast relation.
* The creator of such a Datum is entirely responsible that the referenced
* storage survives for as long as referencing pointer Datums can exist.
*
* Note that just as for struct varatt_external, this struct is stored
* unaligned within any containing tuple.
*/
typedef struct varatt_indirect
{
struct varlena *pointer; /* Pointer to in-memory varlena */
} varatt_indirect;
/*
* struct varatt_expanded is a "TOAST pointer" representing an out-of-line
* Datum that is stored in memory, in some type-specific, not necessarily
* physically contiguous format that is convenient for computation not
* storage. APIs for this, in particular the definition of struct
* ExpandedObjectHeader, are in src/include/utils/expandeddatum.h.
*
* Note that just as for struct varatt_external, this struct is stored
* unaligned within any containing tuple.
*/
typedef struct ExpandedObjectHeader ExpandedObjectHeader;
typedef struct varatt_expanded
{
ExpandedObjectHeader *eohptr;
} varatt_expanded;
/*
* Type tag for the various sorts of "TOAST pointer" datums. The peculiar
* value for VARTAG_ONDISK comes from a requirement for on-disk compatibility
* with a previous notion that the tag field was the pointer datum's length.
*/
typedef enum vartag_external
{
VARTAG_INDIRECT = 1,
VARTAG_EXPANDED_RO = 2,
VARTAG_EXPANDED_RW = 3,
VARTAG_ONDISK = 18
} vartag_external;
/* this test relies on the specific tag values above */
#define VARTAG_IS_EXPANDED(tag) \
(((tag) & ~1) == VARTAG_EXPANDED_RO)
#define VARTAG_SIZE(tag) \
((tag) == VARTAG_INDIRECT ? sizeof(varatt_indirect) : \
VARTAG_IS_EXPANDED(tag) ? sizeof(varatt_expanded) : \
(tag) == VARTAG_ONDISK ? sizeof(varatt_external) : \
TrapMacro(true, "unrecognized TOAST vartag"))
/*
* These structs describe the header of a varlena object that may have been
* TOASTed. Generally, don't reference these structs directly, but use the
* macros below.
*
* We use separate structs for the aligned and unaligned cases because the
* compiler might otherwise think it could generate code that assumes
* alignment while touching fields of a 1-byte-header varlena.
*/
typedef union
{
struct /* Normal varlena (4-byte length) */
{
uint32 va_header;
char va_data[FLEXIBLE_ARRAY_MEMBER];
} va_4byte;
struct /* Compressed-in-line format */
{
uint32 va_header;
uint32 va_rawsize; /* Original data size (excludes header) */
char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Compressed data */
} va_compressed;
} varattrib_4b;
typedef struct
{
uint8 va_header;
char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Data begins here */
} varattrib_1b;
/* TOAST pointers are a subset of varattrib_1b with an identifying tag byte */
typedef struct
{
uint8 va_header; /* Always 0x80 or 0x01 */
uint8 va_tag; /* Type of datum */
char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Type-specific data */
} varattrib_1b_e;
/*
* Bit layouts for varlena headers on big-endian machines:
*
* 00xxxxxx 4-byte length word, aligned, uncompressed data (up to 1G)
* 01xxxxxx 4-byte length word, aligned, *compressed* data (up to 1G)
* 10000000 1-byte length word, unaligned, TOAST pointer
* 1xxxxxxx 1-byte length word, unaligned, uncompressed data (up to 126b)
*
* Bit layouts for varlena headers on little-endian machines:
*
* xxxxxx00 4-byte length word, aligned, uncompressed data (up to 1G)
* xxxxxx10 4-byte length word, aligned, *compressed* data (up to 1G)
* 00000001 1-byte length word, unaligned, TOAST pointer
* xxxxxxx1 1-byte length word, unaligned, uncompressed data (up to 126b)
*
* The "xxx" bits are the length field (which includes itself in all cases).
* In the big-endian case we mask to extract the length, in the little-endian
* case we shift. Note that in both cases the flag bits are in the physically
* first byte. Also, it is not possible for a 1-byte length word to be zero;
* this lets us disambiguate alignment padding bytes from the start of an
* unaligned datum. (We now *require* pad bytes to be filled with zero!)
*
* In TOAST pointers the va_tag field (see varattrib_1b_e) is used to discern
* the specific type and length of the pointer datum.
*/
/*
* Endian-dependent macros. These are considered internal --- use the
* external macros below instead of using these directly.
*
* Note: IS_1B is true for external toast records but VARSIZE_1B will return 0
* for such records. Hence you should usually check for IS_EXTERNAL before
* checking for IS_1B.
*/
#ifdef WORDS_BIGENDIAN
#define VARATT_IS_4B(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00)
#define VARATT_IS_4B_U(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00)
#define VARATT_IS_4B_C(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40)
#define VARATT_IS_1B(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x80)
#define VARATT_IS_1B_E(PTR) \
((((varattrib_1b *) (PTR))->va_header) == 0x80)
#define VARATT_NOT_PAD_BYTE(PTR) \
(*((uint8 *) (PTR)) != 0)
/* VARSIZE_4B() should only be used on known-aligned data */
#define VARSIZE_4B(PTR) \
(((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF)
#define VARSIZE_1B(PTR) \
(((varattrib_1b *) (PTR))->va_header & 0x7F)
#define VARTAG_1B_E(PTR) \
(((varattrib_1b_e *) (PTR))->va_tag)
#define SET_VARSIZE_4B(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF)
#define SET_VARSIZE_4B_C(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = ((len) & 0x3FFFFFFF) | 0x40000000)
#define SET_VARSIZE_1B(PTR,len) \
(((varattrib_1b *) (PTR))->va_header = (len) | 0x80)
#define SET_VARTAG_1B_E(PTR,tag) \
(((varattrib_1b_e *) (PTR))->va_header = 0x80, \
((varattrib_1b_e *) (PTR))->va_tag = (tag))
#else /* !WORDS_BIGENDIAN */
# 236 "../../../../src/include/postgres.h"
#define VARATT_IS_4B(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
#define VARATT_IS_4B_U(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)
#define VARATT_IS_4B_C(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)
#define VARATT_IS_1B(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)
#define VARATT_IS_1B_E(PTR) \
((((varattrib_1b *) (PTR))->va_header) == 0x01)
#define VARATT_NOT_PAD_BYTE(PTR) \
(*((uint8 *) (PTR)) != 0)
/* VARSIZE_4B() should only be used on known-aligned data */
#define VARSIZE_4B(PTR) \
((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)
#define VARSIZE_1B(PTR) \
((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)
#define VARTAG_1B_E(PTR) \
(((varattrib_1b_e *) (PTR))->va_tag)
#define SET_VARSIZE_4B(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2))
#define SET_VARSIZE_4B_C(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02)
#define SET_VARSIZE_1B(PTR,len) \
(((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01)
#define SET_VARTAG_1B_E(PTR,tag) \
(((varattrib_1b_e *) (PTR))->va_header = 0x01, \
((varattrib_1b_e *) (PTR))->va_tag = (tag))
#endif /* WORDS_BIGENDIAN */
# 268 "../../../../src/include/postgres.h"
#define VARHDRSZ_SHORT offsetof(varattrib_1b, va_data)
#define VARATT_SHORT_MAX 0x7F
#define VARATT_CAN_MAKE_SHORT(PTR) \
(VARATT_IS_4B_U(PTR) && \
(VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) <= VARATT_SHORT_MAX)
#define VARATT_CONVERTED_SHORT_SIZE(PTR) \
(VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT)
#define VARHDRSZ_EXTERNAL offsetof(varattrib_1b_e, va_data)
#define VARDATA_4B(PTR) (((varattrib_4b *) (PTR))->va_4byte.va_data)
#define VARDATA_4B_C(PTR) (((varattrib_4b *) (PTR))->va_compressed.va_data)
#define VARDATA_1B(PTR) (((varattrib_1b *) (PTR))->va_data)
#define VARDATA_1B_E(PTR) (((varattrib_1b_e *) (PTR))->va_data)
#define VARRAWSIZE_4B_C(PTR) \
(((varattrib_4b *) (PTR))->va_compressed.va_rawsize)
/* Externally visible macros */
/*
* VARDATA, VARSIZE, and SET_VARSIZE are the recommended API for most code
* for varlena datatypes. Note that they only work on untoasted,
* 4-byte-header Datums!
*
* Code that wants to use 1-byte-header values without detoasting should
* use VARSIZE_ANY/VARSIZE_ANY_EXHDR/VARDATA_ANY. The other macros here
* should usually be used only by tuple assembly/disassembly code and
* code that specifically wants to work with still-toasted Datums.
*
* WARNING: It is only safe to use VARDATA_ANY() -- typically with
* PG_DETOAST_DATUM_PACKED() -- if you really don't care about the alignment.
* Either because you're working with something like text where the alignment
* doesn't matter or because you're not going to access its constituent parts
* and just use things like memcpy on it anyways.
*/
#define VARDATA(PTR) VARDATA_4B(PTR)
#define VARSIZE(PTR) VARSIZE_4B(PTR)
#define VARSIZE_SHORT(PTR) VARSIZE_1B(PTR)
#define VARDATA_SHORT(PTR) VARDATA_1B(PTR)
#define VARTAG_EXTERNAL(PTR) VARTAG_1B_E(PTR)
#define VARSIZE_EXTERNAL(PTR) (VARHDRSZ_EXTERNAL + VARTAG_SIZE(VARTAG_EXTERNAL(PTR)))
#define VARDATA_EXTERNAL(PTR) VARDATA_1B_E(PTR)
#define VARATT_IS_COMPRESSED(PTR) VARATT_IS_4B_C(PTR)
#define VARATT_IS_EXTERNAL(PTR) VARATT_IS_1B_E(PTR)
#define VARATT_IS_EXTERNAL_ONDISK(PTR) \
(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_ONDISK)
#define VARATT_IS_EXTERNAL_INDIRECT(PTR) \
(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_INDIRECT)
#define VARATT_IS_EXTERNAL_EXPANDED_RO(PTR) \
(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RO)
#define VARATT_IS_EXTERNAL_EXPANDED_RW(PTR) \
(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RW)
#define VARATT_IS_EXTERNAL_EXPANDED(PTR) \
(VARATT_IS_EXTERNAL(PTR) && VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))
#define VARATT_IS_SHORT(PTR) VARATT_IS_1B(PTR)
#define VARATT_IS_EXTENDED(PTR) (!VARATT_IS_4B_U(PTR))
#define SET_VARSIZE(PTR, len) SET_VARSIZE_4B(PTR, len)
#define SET_VARSIZE_SHORT(PTR, len) SET_VARSIZE_1B(PTR, len)
#define SET_VARSIZE_COMPRESSED(PTR, len) SET_VARSIZE_4B_C(PTR, len)
#define SET_VARTAG_EXTERNAL(PTR, tag) SET_VARTAG_1B_E(PTR, tag)
#define VARSIZE_ANY(PTR) \
(VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR) : \
(VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \
VARSIZE_4B(PTR)))
/* Size of a varlena data, excluding header */
#define VARSIZE_ANY_EXHDR(PTR) \
(VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR)-VARHDRSZ_EXTERNAL : \
(VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR)-VARHDRSZ_SHORT : \
VARSIZE_4B(PTR)-VARHDRSZ))
/* caution: this will not work on an external or compressed-in-line Datum */
/* caution: this will return a possibly unaligned pointer */
#define VARDATA_ANY(PTR) \
(VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR))
/* ----------------------------------------------------------------
* Section 2: datum type + support macros
* ----------------------------------------------------------------
*/
/*
* Port Notes:
* Postgres makes the following assumptions about datatype sizes:
*
* sizeof(Datum) == sizeof(void *) == 4 or 8
* sizeof(char) == 1
* sizeof(short) == 2
*
* When a type narrower than Datum is stored in a Datum, we place it in the
* low-order bits and are careful that the DatumGetXXX macro for it discards
* the unused high-order bits (as opposed to, say, assuming they are zero).
* This is needed to support old-style user-defined functions, since depending
* on architecture and compiler, the return value of a function returning char
* or short may contain garbage when called as if it returned Datum.
*/
typedef uintptr_t Datum;
#define SIZEOF_DATUM SIZEOF_VOID_P
typedef Datum *DatumPtr;
#define GET_1_BYTE(datum) (((Datum) (datum)) & (uintptr_t)PG_UINT8_MAX)
#define GET_2_BYTES(datum) (((Datum) (datum)) & (uintptr_t)PG_UINT16_MAX)
#define GET_4_BYTES(datum) (((Datum) (datum)) & (uintptr_t)PG_UINT32_MAX)
#if SIZEOF_DATUM >= 8
#define GET_8_BYTES(datum) ((Datum) (datum))
#elif SIZEOF_DATUM > 8
# 386 "../../../../src/include/postgres.h"
#define GET_8_BYTES(datum) (((Datum) (datum)) & (uintptr_t)PG_UINT64_MAX)
#endif
# 388 "../../../../src/include/postgres.h"
#define SET_1_BYTE(value) (((Datum) (value)) & (uintptr_t)PG_UINT8_MAX)
#define SET_2_BYTES(value) (((Datum) (value)) & (uintptr_t)PG_UINT16_MAX)
#define SET_4_BYTES(value) (((Datum) (value)) & (uintptr_t)PG_UINT32_MAX)
#if SIZEOF_DATUM >= 8
#define SET_8_BYTES(value) ((Datum) (value))
#elif SIZEOF_DATUM > 8
# 394 "../../../../src/include/postgres.h"
#define SET_8_BYTES(value) (((Datum) (value)) & (uintptr_t)PG_UINT64_MAX)
#endif
# 396 "../../../../src/include/postgres.h"
/*
* DatumGetBool
* Returns boolean value of a datum.
*
* Note: any nonzero value will be considered TRUE, but we ignore bits to
* the left of the width of bool, per comment above.
*/
#define DatumGetBool(X) ((bool) (GET_1_BYTE(X) != 0))
/*
* BoolGetDatum
* Returns datum representation for a boolean.
*
* Note: any nonzero value will be considered TRUE.
*/
#define BoolGetDatum(X) ((Datum) ((X) ? 1 : 0))
/*
* DatumGetChar
* Returns character value of a datum.
*/
#define DatumGetChar(X) ((char) GET_1_BYTE(X))
/*
* CharGetDatum
* Returns datum representation for a character.
*/
#define CharGetDatum(X) ((Datum) SET_1_BYTE(X))
/*
* Int8GetDatum
* Returns datum representation for an 8-bit integer.
*/
#define Int8GetDatum(X) ((Datum) SET_1_BYTE(X))
/*
* DatumGetUInt8
* Returns 8-bit unsigned integer value of a datum.
*/
#define DatumGetUInt8(X) ((uint8) GET_1_BYTE(X))
/*
* UInt8GetDatum
* Returns datum representation for an 8-bit unsigned integer.
*/
#define UInt8GetDatum(X) ((Datum) SET_1_BYTE(X))
/*
* DatumGetInt16
* Returns 16-bit integer value of a datum.
*/
#define DatumGetInt16(X) ((int16) GET_2_BYTES(X))
/*
* Int16GetDatum
* Returns datum representation for a 16-bit integer.
*/
#define Int16GetDatum(X) ((Datum) SET_2_BYTES(X))
/*
* DatumGetUInt16
* Returns 16-bit unsigned integer value of a datum.
*/
#define DatumGetUInt16(X) ((uint16) GET_2_BYTES(X))
/*
* UInt16GetDatum
* Returns datum representation for a 16-bit unsigned integer.
*/
#define UInt16GetDatum(X) ((Datum) SET_2_BYTES(X))
/*
* DatumGetInt32
* Returns 32-bit integer value of a datum.
*/
#define DatumGetInt32(X) ((int32) GET_4_BYTES(X))
/*
* Int32GetDatum
* Returns datum representation for a 32-bit integer.
*/
#define Int32GetDatum(X) ((Datum) SET_4_BYTES(X))
/*
* DatumGetUInt32
* Returns 32-bit unsigned integer value of a datum.
*/
#define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X))
/*
* UInt32GetDatum
* Returns datum representation for a 32-bit unsigned integer.
*/
#define UInt32GetDatum(X) ((Datum) SET_4_BYTES(X))
/*
* DatumGetObjectId
* Returns object identifier value of a datum.
*/
#define DatumGetObjectId(X) ((Oid) GET_4_BYTES(X))
/*
* ObjectIdGetDatum
* Returns datum representation for an object identifier.
*/
#define ObjectIdGetDatum(X) ((Datum) SET_4_BYTES(X))
/*
* DatumGetTransactionId
* Returns transaction identifier value of a datum.
*/
#define DatumGetTransactionId(X) ((TransactionId) GET_4_BYTES(X))
/*
* TransactionIdGetDatum
* Returns datum representation for a transaction identifier.
*/
#define TransactionIdGetDatum(X) ((Datum) SET_4_BYTES((X)))
/*
* MultiXactIdGetDatum
* Returns datum representation for a multixact identifier.
*/
#define MultiXactIdGetDatum(X) ((Datum) SET_4_BYTES((X)))
/*
* DatumGetCommandId
* Returns command identifier value of a datum.
*/
#define DatumGetCommandId(X) ((CommandId) GET_4_BYTES(X))
/*
* CommandIdGetDatum
* Returns datum representation for a command identifier.
*/
#define CommandIdGetDatum(X) ((Datum) SET_4_BYTES(X))
/*
* DatumGetPointer
* Returns pointer value of a datum.
*/
#define DatumGetPointer(X) ((Pointer) (X))
/*
* PointerGetDatum
* Returns datum representation for a pointer.
*/
#define PointerGetDatum(X) ((Datum) (X))
/*
* DatumGetCString
* Returns C string (null-terminated string) value of a datum.
*
* Note: C string is not a full-fledged Postgres type at present,
* but type input functions use this conversion for their inputs.
*/
#define DatumGetCString(X) ((char *) DatumGetPointer(X))
/*
* CStringGetDatum
* Returns datum representation for a C string (null-terminated string).
*
* Note: C string is not a full-fledged Postgres type at present,
* but type output functions use this conversion for their outputs.
* Note: CString is pass-by-reference; caller must ensure the pointed-to
* value has adequate lifetime.
*/
#define CStringGetDatum(X) PointerGetDatum(X)
/*
* DatumGetName
* Returns name value of a datum.
*/
#define DatumGetName(X) ((Name) DatumGetPointer(X))
/*
* NameGetDatum
* Returns datum representation for a name.
*
* Note: Name is pass-by-reference; caller must ensure the pointed-to
* value has adequate lifetime.
*/
#define NameGetDatum(X) PointerGetDatum(X)
/*
* DatumGetInt64
* Returns 64-bit integer value of a datum.
*
* Note: this macro hides whether int64 is pass by value or by reference.
*/
#ifdef USE_FLOAT8_BYVAL
#define DatumGetInt64(X) ((int64) GET_8_BYTES(X))
#else
# 619 "../../../../src/include/postgres.h"
#define DatumGetInt64(X) (* ((int64 *) DatumGetPointer(X)))
#endif
# 621 "../../../../src/include/postgres.h"
/*
* Int64GetDatum
* Returns datum representation for a 64-bit integer.
*
* Note: if int64 is pass by reference, this function returns a reference
* to palloc'd space.
*/
#ifdef USE_FLOAT8_BYVAL
#define Int64GetDatum(X) ((Datum) SET_8_BYTES(X))
#else
# 633 "../../../../src/include/postgres.h"
extern Datum Int64GetDatum(int64 X);
#endif
# 635 "../../../../src/include/postgres.h"
/*
* DatumGetUInt64
* Returns 64-bit unsigned integer value of a datum.
*
* Note: this macro hides whether int64 is pass by value or by reference.
*/
#ifdef USE_FLOAT8_BYVAL
#define DatumGetUInt64(X) ((uint64) GET_8_BYTES(X))
#else
# 646 "../../../../src/include/postgres.h"
#define DatumGetUInt64(X) (* ((uint64 *) DatumGetPointer(X)))
#endif
# 648 "../../../../src/include/postgres.h"
/*
* UInt64GetDatum
* Returns datum representation for a 64-bit unsigned integer.
*
* Note: if int64 is pass by reference, this function returns a reference
* to palloc'd space.
*/
#ifdef USE_FLOAT8_BYVAL
#define UInt64GetDatum(X) ((Datum) SET_8_BYTES(X))
#else
# 660 "../../../../src/include/postgres.h"
#define UInt64GetDatum(X) Int64GetDatum((int64) (X))
#endif
# 662 "../../../../src/include/postgres.h"
/*
* DatumGetFloat4
* Returns 4-byte floating point value of a datum.
*
* Note: this macro hides whether float4 is pass by value or by reference.
*/
#ifdef USE_FLOAT4_BYVAL
extern float4 DatumGetFloat4(Datum X);
#else
# 673 "../../../../src/include/postgres.h"
#define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X)))
#endif
# 675 "../../../../src/include/postgres.h"
/*
* Float4GetDatum
* Returns datum representation for a 4-byte floating point number.
*
* Note: if float4 is pass by reference, this function returns a reference
* to palloc'd space.
*/
extern Datum Float4GetDatum(float4 X);
/*
* DatumGetFloat8
* Returns 8-byte floating point value of a datum.
*
* Note: this macro hides whether float8 is pass by value or by reference.
*/
#ifdef USE_FLOAT8_BYVAL
extern float8 DatumGetFloat8(Datum X);
#else
# 696 "../../../../src/include/postgres.h"
#define DatumGetFloat8(X) (* ((float8 *) DatumGetPointer(X)))
#endif
# 698 "../../../../src/include/postgres.h"
/*
* Float8GetDatum
* Returns datum representation for an 8-byte floating point number.
*
* Note: if float8 is pass by reference, this function returns a reference
* to palloc'd space.
*/
extern Datum Float8GetDatum(float8 X);
/*
* Int64GetDatumFast
* Float8GetDatumFast
* Float4GetDatumFast
*
* These macros are intended to allow writing code that does not depend on
* whether int64, float8, float4 are pass-by-reference types, while not
* sacrificing performance when they are. The argument must be a variable
* that will exist and have the same value for as long as the Datum is needed.
* In the pass-by-ref case, the address of the variable is taken to use as
* the Datum. In the pass-by-val case, these will be the same as the non-Fast
* macros.
*/
#ifdef USE_FLOAT8_BYVAL
#define Int64GetDatumFast(X) Int64GetDatum(X)
#define Float8GetDatumFast(X) Float8GetDatum(X)
#else
# 728 "../../../../src/include/postgres.h"
#define Int64GetDatumFast(X) PointerGetDatum(&(X))
#define Float8GetDatumFast(X) PointerGetDatum(&(X))
#endif
# 731 "../../../../src/include/postgres.h"
#ifdef USE_FLOAT4_BYVAL
#define Float4GetDatumFast(X) Float4GetDatum(X)
#else
# 735 "../../../../src/include/postgres.h"
#define Float4GetDatumFast(X) PointerGetDatum(&(X))
#endif
# 737 "../../../../src/include/postgres.h"
/* ----------------------------------------------------------------
* Section 3: exception handling backend support
* ----------------------------------------------------------------
*/
/*
* Backend only infrastructure for the assertion-related macros in c.h.
*
* ExceptionalCondition must be present even when assertions are not enabled.
*/
extern void ExceptionalCondition(const char *conditionName,
const char *errorType,
const char *fileName, int lineNumber) pg_attribute_noreturn();
#endif /* POSTGRES_H */
# 754 "../../../../src/include/postgres.h"
# 17 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/genam.h"
#endif /* expanded by -frewrite-includes */
# 18 "spgdoinsert.c"
# 1 "../../../../src/include/access/genam.h" 1
/*-------------------------------------------------------------------------
*
* genam.h
* POSTGRES generalized index access method definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/genam.h
*
*-------------------------------------------------------------------------
*/
#ifndef GENAM_H
#define GENAM_H
#if 0 /* expanded by -frewrite-includes */
#include "access/sdir.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/access/sdir.h" 1
/*-------------------------------------------------------------------------
*
* sdir.h
* POSTGRES scan direction definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/sdir.h
*
*-------------------------------------------------------------------------
*/
#ifndef SDIR_H
#define SDIR_H
/*
* ScanDirection was an int8 for no apparent reason. I kept the original
* values because I'm not sure if I'll break anything otherwise. -ay 2/95
*/
typedef enum ScanDirection
{
BackwardScanDirection = -1,
NoMovementScanDirection = 0,
ForwardScanDirection = 1
} ScanDirection;
/*
* ScanDirectionIsValid
* True iff scan direction is valid.
*/
#define ScanDirectionIsValid(direction) \
((bool) (BackwardScanDirection <= (direction) && \
(direction) <= ForwardScanDirection))
/*
* ScanDirectionIsBackward
* True iff scan direction is backward.
*/
#define ScanDirectionIsBackward(direction) \
((bool) ((direction) == BackwardScanDirection))
/*
* ScanDirectionIsNoMovement
* True iff scan direction indicates no movement.
*/
#define ScanDirectionIsNoMovement(direction) \
((bool) ((direction) == NoMovementScanDirection))
/*
* ScanDirectionIsForward
* True iff scan direction is forward.
*/
#define ScanDirectionIsForward(direction) \
((bool) ((direction) == ForwardScanDirection))
#endif /* SDIR_H */
# 59 "../../../../src/include/access/sdir.h"
# 18 "../../../../src/include/access/genam.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/skey.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/access/skey.h" 1
/*-------------------------------------------------------------------------
*
* skey.h
* POSTGRES scan key definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/skey.h
*
*-------------------------------------------------------------------------
*/
#ifndef SKEY_H
#define SKEY_H
#if 0 /* expanded by -frewrite-includes */
#include "access/attnum.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/skey.h"
# 1 "../../../../src/include/access/attnum.h" 1
/*-------------------------------------------------------------------------
*
* attnum.h
* POSTGRES attribute number definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/attnum.h
*
*-------------------------------------------------------------------------
*/
#ifndef ATTNUM_H
#define ATTNUM_H
/*
* user defined attribute numbers start at 1. -ay 2/95
*/
typedef int16 AttrNumber;
#define InvalidAttrNumber 0
#define MaxAttrNumber 32767
/* ----------------
* support macros
* ----------------
*/
/*
* AttributeNumberIsValid
* True iff the attribute number is valid.
*/
#define AttributeNumberIsValid(attributeNumber) \
((bool) ((attributeNumber) != InvalidAttrNumber))
/*
* AttrNumberIsForUserDefinedAttr
* True iff the attribute number corresponds to an user defined attribute.
*/
#define AttrNumberIsForUserDefinedAttr(attributeNumber) \
((bool) ((attributeNumber) > 0))
/*
* AttrNumberGetAttrOffset
* Returns the attribute offset for an attribute number.
*
* Note:
* Assumes the attribute number is for a user defined attribute.
*/
#define AttrNumberGetAttrOffset(attNum) \
( \
AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
((attNum) - 1) \
)
/*
* AttributeOffsetGetAttributeNumber
* Returns the attribute number for an attribute offset.
*/
#define AttrOffsetGetAttrNumber(attributeOffset) \
((AttrNumber) (1 + (attributeOffset)))
#endif /* ATTNUM_H */
# 65 "../../../../src/include/access/attnum.h"
# 18 "../../../../src/include/access/skey.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/stratnum.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/skey.h"
# 1 "../../../../src/include/access/stratnum.h" 1
/*-------------------------------------------------------------------------
*
* stratnum.h
* POSTGRES strategy number definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/stratnum.h
*
*-------------------------------------------------------------------------
*/
#ifndef STRATNUM_H
#define STRATNUM_H
/*
* Strategy numbers identify the semantics that particular operators have
* with respect to particular operator classes. In some cases a strategy
* subtype (an OID) is used as further information.
*/
typedef uint16 StrategyNumber;
#define InvalidStrategy ((StrategyNumber) 0)
/*
* Strategy numbers for B-tree indexes.
*/
#define BTLessStrategyNumber 1
#define BTLessEqualStrategyNumber 2
#define BTEqualStrategyNumber 3
#define BTGreaterEqualStrategyNumber 4
#define BTGreaterStrategyNumber 5
#define BTMaxStrategyNumber 5
/*
* Strategy numbers common to (some) GiST, SP-GiST and BRIN opclasses.
*
* The first few of these come from the R-Tree indexing method (hence the
* names); the others have been added over time as they have been needed.
*/
#define RTLeftStrategyNumber 1 /* for << */
#define RTOverLeftStrategyNumber 2 /* for &< */
#define RTOverlapStrategyNumber 3 /* for && */
#define RTOverRightStrategyNumber 4 /* for &> */
#define RTRightStrategyNumber 5 /* for >> */
#define RTSameStrategyNumber 6 /* for ~= */
#define RTContainsStrategyNumber 7 /* for @> */
#define RTContainedByStrategyNumber 8 /* for <@ */
#define RTOverBelowStrategyNumber 9 /* for &<| */
#define RTBelowStrategyNumber 10 /* for <<| */
#define RTAboveStrategyNumber 11 /* for |>> */
#define RTOverAboveStrategyNumber 12 /* for |&> */
#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */
#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */
#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */
#define RTContainsElemStrategyNumber 16 /* for range types @> elem */
#define RTAdjacentStrategyNumber 17 /* for -|- */
#define RTEqualStrategyNumber 18 /* for = */
#define RTNotEqualStrategyNumber 19 /* for != */
#define RTLessStrategyNumber 20 /* for < */
#define RTLessEqualStrategyNumber 21 /* for <= */
#define RTGreaterStrategyNumber 22 /* for > */
#define RTGreaterEqualStrategyNumber 23 /* for >= */
#define RTSubStrategyNumber 24 /* for inet >> */
#define RTSubEqualStrategyNumber 25 /* for inet <<= */
#define RTSuperStrategyNumber 26 /* for inet << */
#define RTSuperEqualStrategyNumber 27 /* for inet >>= */
#define RTMaxStrategyNumber 27
#endif /* STRATNUM_H */
# 76 "../../../../src/include/access/stratnum.h"
# 19 "../../../../src/include/access/skey.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "fmgr.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/skey.h"
# 1 "../../../../src/include/fmgr.h" 1
/*-------------------------------------------------------------------------
*
* fmgr.h
* Definitions for the Postgres function manager and function-call
* interface.
*
* This file must be included by all Postgres modules that either define
* or call fmgr-callable functions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/fmgr.h
*
*-------------------------------------------------------------------------
*/
#ifndef FMGR_H
#define FMGR_H
/* We don't want to include primnodes.h here, so make some stub references */
typedef struct Node *fmNodePtr;
typedef struct Aggref *fmAggrefPtr;
/* Likewise, avoid including execnodes.h here */
typedef void (*fmExprContextCallbackFunction) (Datum arg);
/* Likewise, avoid including stringinfo.h here */
typedef struct StringInfoData *fmStringInfo;
/*
* All functions that can be called directly by fmgr must have this signature.
* (Other functions can be called by using a handler that does have this
* signature.)
*/
typedef struct FunctionCallInfoData *FunctionCallInfo;
typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
/*
* This struct holds the system-catalog information that must be looked up
* before a function can be called through fmgr. If the same function is
* to be called multiple times, the lookup need be done only once and the
* info struct saved for re-use.
*
* Note that fn_expr really is parse-time-determined information about the
* arguments, rather than about the function itself. But it's convenient
* to store it here rather than in FunctionCallInfoData, where it might more
* logically belong.
*/
typedef struct FmgrInfo
{
PGFunction fn_addr; /* pointer to function or handler to be called */
Oid fn_oid; /* OID of function (NOT of handler, if any) */
short fn_nargs; /* number of input args (0..FUNC_MAX_ARGS) */
bool fn_strict; /* function is "strict" (NULL in => NULL out) */
bool fn_retset; /* function returns a set */
unsigned char fn_stats; /* collect stats if track_functions > this */
void *fn_extra; /* extra space for use by handler */
MemoryContext fn_mcxt; /* memory context to store fn_extra in */
fmNodePtr fn_expr; /* expression parse tree for call, or NULL */
} FmgrInfo;
/*
* This struct is the data actually passed to an fmgr-called function.
*/
typedef struct FunctionCallInfoData
{
FmgrInfo *flinfo; /* ptr to lookup info used for this call */
fmNodePtr context; /* pass info about context of call */
fmNodePtr resultinfo; /* pass or return extra info about result */
Oid fncollation; /* collation for function to use */
bool isnull; /* function must set true if result is NULL */
short nargs; /* # arguments actually passed */
Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */
bool argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */
} FunctionCallInfoData;
/*
* This routine fills a FmgrInfo struct, given the OID
* of the function to be called.
*/
extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
/*
* Same, when the FmgrInfo struct is in a memory context longer-lived than
* CurrentMemoryContext. The specified context will be set as fn_mcxt
* and used to hold all subsidiary data of finfo.
*/
extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
MemoryContext mcxt);
/* Convenience macro for setting the fn_expr field */
#define fmgr_info_set_expr(expr, finfo) \
((finfo)->fn_expr = (expr))
/*
* Copy an FmgrInfo struct
*/
extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
MemoryContext destcxt);
/*
* This macro initializes all the fields of a FunctionCallInfoData except
* for the arg[] and argnull[] arrays. Performance testing has shown that
* the fastest way to set up argnull[] for small numbers of arguments is to
* explicitly set each required element to false, so we don't try to zero
* out the argnull[] array in the macro.
*/
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \
do { \
(Fcinfo).flinfo = (Flinfo); \
(Fcinfo).context = (Context); \
(Fcinfo).resultinfo = (Resultinfo); \
(Fcinfo).fncollation = (Collation); \
(Fcinfo).isnull = false; \
(Fcinfo).nargs = (Nargs); \
} while (0)
/*
* This macro invokes a function given a filled-in FunctionCallInfoData
* struct. The macro result is the returned Datum --- but note that
* caller must still check fcinfo->isnull! Also, if function is strict,
* it is caller's responsibility to verify that no null arguments are present
* before calling.
*/
#define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo))
/*-------------------------------------------------------------------------
* Support macros to ease writing fmgr-compatible functions
*
* A C-coded fmgr-compatible function should be declared as
*
* Datum
* function_name(PG_FUNCTION_ARGS)
* {
* ...
* }
*
* It should access its arguments using appropriate PG_GETARG_xxx macros
* and should return its result using PG_RETURN_xxx.
*
*-------------------------------------------------------------------------
*/
/* Standard parameter list for fmgr-compatible functions */
#define PG_FUNCTION_ARGS FunctionCallInfo fcinfo
/*
* Get collation function should use.
*/
#define PG_GET_COLLATION() (fcinfo->fncollation)
/*
* Get number of arguments passed to function.
*/
#define PG_NARGS() (fcinfo->nargs)
/*
* If function is not marked "proisstrict" in pg_proc, it must check for
* null arguments using this macro. Do not try to GETARG a null argument!
*/
#define PG_ARGISNULL(n) (fcinfo->argnull[n])
/*
* Support for fetching detoasted copies of toastable datatypes (all of
* which are varlena types). pg_detoast_datum() gives you either the input
* datum (if not toasted) or a detoasted copy allocated with palloc().
* pg_detoast_datum_copy() always gives you a palloc'd copy --- use it
* if you need a modifiable copy of the input. Caller is expected to have
* checked for null inputs first, if necessary.
*
* pg_detoast_datum_packed() will return packed (1-byte header) datums
* unmodified. It will still expand an externally toasted or compressed datum.
* The resulting datum can be accessed using VARSIZE_ANY() and VARDATA_ANY()
* (beware of multiple evaluations in those macros!)
*
* WARNING: It is only safe to use pg_detoast_datum_packed() and
* VARDATA_ANY() if you really don't care about the alignment. Either because
* you're working with something like text where the alignment doesn't matter
* or because you're not going to access its constituent parts and just use
* things like memcpy on it anyways.
*
* Note: it'd be nice if these could be macros, but I see no way to do that
* without evaluating the arguments multiple times, which is NOT acceptable.
*/
extern struct varlena *pg_detoast_datum(struct varlena * datum);
extern struct varlena *pg_detoast_datum_copy(struct varlena * datum);
extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
int32 first, int32 count);
extern struct varlena *pg_detoast_datum_packed(struct varlena * datum);
#define PG_DETOAST_DATUM(datum) \
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
#define PG_DETOAST_DATUM_COPY(datum) \
pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
#define PG_DETOAST_DATUM_SLICE(datum,f,c) \
pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
(int32) (f), (int32) (c))
/* WARNING -- unaligned pointer */
#define PG_DETOAST_DATUM_PACKED(datum) \
pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
/*
* Support for cleaning up detoasted copies of inputs. This must only
* be used for pass-by-ref datatypes, and normally would only be used
* for toastable types. If the given pointer is different from the
* original argument, assume it's a palloc'd detoasted copy, and pfree it.
* NOTE: most functions on toastable types do not have to worry about this,
* but we currently require that support functions for indexes not leak
* memory.
*/
#define PG_FREE_IF_COPY(ptr,n) \
do { \
if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
pfree(ptr); \
} while (0)
/* Macros for fetching arguments of standard types */
#define PG_GETARG_DATUM(n) (fcinfo->arg[n])
#define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n))
#define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n))
#define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n))
#define PG_GETARG_UINT16(n) DatumGetUInt16(PG_GETARG_DATUM(n))
#define PG_GETARG_CHAR(n) DatumGetChar(PG_GETARG_DATUM(n))
#define PG_GETARG_BOOL(n) DatumGetBool(PG_GETARG_DATUM(n))
#define PG_GETARG_OID(n) DatumGetObjectId(PG_GETARG_DATUM(n))
#define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
#define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
#define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n))
/* these macros hide the pass-by-reference-ness of the datatype: */
#define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n))
#define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n))
#define PG_GETARG_INT64(n) DatumGetInt64(PG_GETARG_DATUM(n))
/* use this if you want the raw, possibly-toasted input datum: */
#define PG_GETARG_RAW_VARLENA_P(n) ((struct varlena *) PG_GETARG_POINTER(n))
/* use this if you want the input datum de-toasted: */
#define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
/* and this if you can handle 1-byte-header datums: */
#define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
/* DatumGetFoo macros for varlena types will typically look like this: */
#define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X))
#define DatumGetByteaPP(X) ((bytea *) PG_DETOAST_DATUM_PACKED(X))
#define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X))
#define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X))
#define DatumGetBpCharP(X) ((BpChar *) PG_DETOAST_DATUM(X))
#define DatumGetBpCharPP(X) ((BpChar *) PG_DETOAST_DATUM_PACKED(X))
#define DatumGetVarCharP(X) ((VarChar *) PG_DETOAST_DATUM(X))
#define DatumGetVarCharPP(X) ((VarChar *) PG_DETOAST_DATUM_PACKED(X))
#define DatumGetHeapTupleHeader(X) ((HeapTupleHeader) PG_DETOAST_DATUM(X))
/* And we also offer variants that return an OK-to-write copy */
#define DatumGetByteaPCopy(X) ((bytea *) PG_DETOAST_DATUM_COPY(X))
#define DatumGetTextPCopy(X) ((text *) PG_DETOAST_DATUM_COPY(X))
#define DatumGetBpCharPCopy(X) ((BpChar *) PG_DETOAST_DATUM_COPY(X))
#define DatumGetVarCharPCopy(X) ((VarChar *) PG_DETOAST_DATUM_COPY(X))
#define DatumGetHeapTupleHeaderCopy(X) ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
/* Variants which return n bytes starting at pos. m */
#define DatumGetByteaPSlice(X,m,n) ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
#define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
#define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
#define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
/* GETARG macros for varlena types will typically look like this: */
#define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n))
#define PG_GETARG_BYTEA_PP(n) DatumGetByteaPP(PG_GETARG_DATUM(n))
#define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n))
#define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n))
#define PG_GETARG_BPCHAR_P(n) DatumGetBpCharP(PG_GETARG_DATUM(n))
#define PG_GETARG_BPCHAR_PP(n) DatumGetBpCharPP(PG_GETARG_DATUM(n))
#define PG_GETARG_VARCHAR_P(n) DatumGetVarCharP(PG_GETARG_DATUM(n))
#define PG_GETARG_VARCHAR_PP(n) DatumGetVarCharPP(PG_GETARG_DATUM(n))
#define PG_GETARG_HEAPTUPLEHEADER(n) DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
/* And we also offer variants that return an OK-to-write copy */
#define PG_GETARG_BYTEA_P_COPY(n) DatumGetByteaPCopy(PG_GETARG_DATUM(n))
#define PG_GETARG_TEXT_P_COPY(n) DatumGetTextPCopy(PG_GETARG_DATUM(n))
#define PG_GETARG_BPCHAR_P_COPY(n) DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
#define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
#define PG_GETARG_HEAPTUPLEHEADER_COPY(n) DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
/* And a b-byte slice from position a -also OK to write */
#define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
#define PG_GETARG_TEXT_P_SLICE(n,a,b) DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
#define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
#define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
/* To return a NULL do this: */
#define PG_RETURN_NULL() \
do { fcinfo->isnull = true; return (Datum) 0; } while (0)
/* A few internal functions return void (which is not the same as NULL!) */
#define PG_RETURN_VOID() return (Datum) 0
/* Macros for returning results of standard types */
#define PG_RETURN_DATUM(x) return (x)
#define PG_RETURN_INT32(x) return Int32GetDatum(x)
#define PG_RETURN_UINT32(x) return UInt32GetDatum(x)
#define PG_RETURN_INT16(x) return Int16GetDatum(x)
#define PG_RETURN_UINT16(x) return UInt16GetDatum(x)
#define PG_RETURN_CHAR(x) return CharGetDatum(x)
#define PG_RETURN_BOOL(x) return BoolGetDatum(x)
#define PG_RETURN_OID(x) return ObjectIdGetDatum(x)
#define PG_RETURN_POINTER(x) return PointerGetDatum(x)
#define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
#define PG_RETURN_NAME(x) return NameGetDatum(x)
/* these macros hide the pass-by-reference-ness of the datatype: */
#define PG_RETURN_FLOAT4(x) return Float4GetDatum(x)
#define PG_RETURN_FLOAT8(x) return Float8GetDatum(x)
#define PG_RETURN_INT64(x) return Int64GetDatum(x)
/* RETURN macros for other pass-by-ref types will typically look like this: */
#define PG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x)
#define PG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x)
#define PG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x)
#define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
#define PG_RETURN_HEAPTUPLEHEADER(x) return HeapTupleHeaderGetDatum(x)
/*-------------------------------------------------------------------------
* Support for detecting call convention of dynamically-loaded functions
*
* Dynamically loaded functions may use either the version-1 ("new style")
* or version-0 ("old style") calling convention. Version 1 is the call
* convention defined in this header file; version 0 is the old "plain C"
* convention. A version-1 function must be accompanied by the macro call
*
* PG_FUNCTION_INFO_V1(function_name);
*
* Note that internal functions do not need this decoration since they are
* assumed to be version-1.
*
*-------------------------------------------------------------------------
*/
typedef struct
{
int api_version; /* specifies call convention version number */
/* More fields may be added later, for version numbers > 1. */
} Pg_finfo_record;
/* Expected signature of an info function */
typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
/*
* Macro to build an info function associated with the given function name.
*
* As a convenience, also provide an "extern" declaration for the given
* function name, so that writers of C functions need not write that too.
*
* On Windows, the function and info function must be exported. Our normal
* build processes take care of that via .DEF files or --export-all-symbols.
* Module authors using a different build process might need to manually
* declare the function PGDLLEXPORT. We do that automatically here for the
* info function, since authors shouldn't need to be explicitly aware of it.
*/
#define PG_FUNCTION_INFO_V1(funcname) \
extern Datum funcname(PG_FUNCTION_ARGS); \
extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
const Pg_finfo_record * \
CppConcat(pg_finfo_,funcname) (void) \
{ \
static const Pg_finfo_record my_finfo = { 1 }; \
return &my_finfo; \
} \
extern int no_such_variable
/*-------------------------------------------------------------------------
* Support for verifying backend compatibility of loaded modules
*
* We require dynamically-loaded modules to include the macro call
* PG_MODULE_MAGIC;
* so that we can check for obvious incompatibility, such as being compiled
* for a different major PostgreSQL version.
*
* To compile with versions of PostgreSQL that do not support this,
* you may put an #ifdef/#endif test around it. Note that in a multiple-
* source-file module, the macro call should only appear once.
*
* The specific items included in the magic block are intended to be ones that
* are custom-configurable and especially likely to break dynamically loaded
* modules if they were compiled with other values. Also, the length field
* can be used to detect definition changes.
*
* Note: we compare magic blocks with memcmp(), so there had better not be
* any alignment pad bytes in them.
*
* Note: when changing the contents of magic blocks, be sure to adjust the
* incompatible_module_error() function in dfmgr.c.
*-------------------------------------------------------------------------
*/
/* Definition of the magic block structure */
typedef struct
{
int len; /* sizeof(this struct) */
int version; /* PostgreSQL major version */
int funcmaxargs; /* FUNC_MAX_ARGS */
int indexmaxkeys; /* INDEX_MAX_KEYS */
int namedatalen; /* NAMEDATALEN */
int float4byval; /* FLOAT4PASSBYVAL */
int float8byval; /* FLOAT8PASSBYVAL */
} Pg_magic_struct;
/* The actual data block contents */
#define PG_MODULE_MAGIC_DATA \
{ \
sizeof(Pg_magic_struct), \
PG_VERSION_NUM / 100, \
FUNC_MAX_ARGS, \
INDEX_MAX_KEYS, \
NAMEDATALEN, \
FLOAT4PASSBYVAL, \
FLOAT8PASSBYVAL \
}
/*
* Declare the module magic function. It needs to be a function as the dlsym
* in the backend is only guaranteed to work on functions, not data
*/
typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void);
#define PG_MAGIC_FUNCTION_NAME Pg_magic_func
#define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func"
#define PG_MODULE_MAGIC \
extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \
const Pg_magic_struct * \
PG_MAGIC_FUNCTION_NAME(void) \
{ \
static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \
return &Pg_magic_data; \
} \
extern int no_such_variable
/*-------------------------------------------------------------------------
* Support routines and macros for callers of fmgr-compatible functions
*-------------------------------------------------------------------------
*/
/* These are for invocation of a specifically named function with a
* directly-computed parameter list. Note that neither arguments nor result
* are allowed to be NULL.
*/
extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation,
Datum arg1);
extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2);
extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3);
extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4);
extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5);
extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6);
extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7);
extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8);
extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8,
Datum arg9);
/* These are for invocation of a previously-looked-up function with a
* directly-computed parameter list. Note that neither arguments nor result
* are allowed to be NULL.
*/
extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1);
extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2);
extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3);
extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4);
extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5);
extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6);
extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7);
extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8);
extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8,
Datum arg9);
/* These are for invocation of a function identified by OID with a
* directly-computed parameter list. Note that neither arguments nor result
* are allowed to be NULL. These are essentially fmgr_info() followed by
* FunctionCallN(). If the same function is to be invoked repeatedly, do the
* fmgr_info() once and then use FunctionCallN().
*/
extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation);
extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation,
Datum arg1);
extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2);
extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3);
extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4);
extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5);
extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6);
extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7);
extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8);
extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation,
Datum arg1, Datum arg2,
Datum arg3, Datum arg4, Datum arg5,
Datum arg6, Datum arg7, Datum arg8,
Datum arg9);
/* These macros allow the collation argument to be omitted (with a default of
* InvalidOid, ie, no collation). They exist mostly for backwards
* compatibility of source code.
*/
#define DirectFunctionCall1(func, arg1) \
DirectFunctionCall1Coll(func, InvalidOid, arg1)
#define DirectFunctionCall2(func, arg1, arg2) \
DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)
#define DirectFunctionCall3(func, arg1, arg2, arg3) \
DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)
#define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \
DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)
#define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \
DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)
#define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \
DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
#define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
#define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
#define FunctionCall1(flinfo, arg1) \
FunctionCall1Coll(flinfo, InvalidOid, arg1)
#define FunctionCall2(flinfo, arg1, arg2) \
FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)
#define FunctionCall3(flinfo, arg1, arg2, arg3) \
FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)
#define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \
FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)
#define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \
FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)
#define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \
FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
#define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
#define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
#define OidFunctionCall0(functionId) \
OidFunctionCall0Coll(functionId, InvalidOid)
#define OidFunctionCall1(functionId, arg1) \
OidFunctionCall1Coll(functionId, InvalidOid, arg1)
#define OidFunctionCall2(functionId, arg1, arg2) \
OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)
#define OidFunctionCall3(functionId, arg1, arg2, arg3) \
OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)
#define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \
OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)
#define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \
OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)
#define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \
OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
#define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
#define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
/* Special cases for convenient invocation of datatype I/O functions. */
extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str,
Oid typioparam, int32 typmod);
extern Datum OidInputFunctionCall(Oid functionId, char *str,
Oid typioparam, int32 typmod);
extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val);
extern char *OidOutputFunctionCall(Oid functionId, Datum val);
extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf,
Oid typioparam, int32 typmod);
extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf,
Oid typioparam, int32 typmod);
extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val);
extern bytea *OidSendFunctionCall(Oid functionId, Datum val);
/*
* Routines in fmgr.c
*/
extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, char *funcname);
extern void clear_external_function_hash(void *filehandle);
extern Oid fmgr_internal_function(const char *proname);
extern Oid get_fn_expr_rettype(FmgrInfo *flinfo);
extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum);
extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum);
extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum);
extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum);
extern bool get_fn_expr_variadic(FmgrInfo *flinfo);
extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid);
/*
* Routines in dfmgr.c
*/
extern char *Dynamic_library_path;
extern PGFunction load_external_function(char *filename, char *funcname,
bool signalNotFound, void **filehandle);
extern PGFunction lookup_external_function(void *filehandle, char *funcname);
extern void load_file(const char *filename, bool restricted);
extern void **find_rendezvous_variable(const char *varName);
extern Size EstimateLibraryStateSpace(void);
extern void SerializeLibraryState(Size maxsize, char *start_address);
extern void RestoreLibraryState(char *start_address);
/*
* Support for aggregate functions
*
* These are actually in executor/nodeAgg.c, but we declare them here since
* the whole point is for callers to not be overly friendly with nodeAgg.
*/
/* AggCheckCallContext can return one of the following codes, or 0: */
#define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */
#define AGG_CONTEXT_WINDOW 2 /* window function */
extern int AggCheckCallContext(FunctionCallInfo fcinfo,
MemoryContext *aggcontext);
extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo);
extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo);
extern void AggRegisterCallback(FunctionCallInfo fcinfo,
fmExprContextCallbackFunction func,
Datum arg);
/*
* We allow plugin modules to hook function entry/exit. This is intended
* as support for loadable security policy modules, which may want to
* perform additional privilege checks on function entry or exit, or to do
* other internal bookkeeping. To make this possible, such modules must be
* able not only to support normal function entry and exit, but also to trap
* the case where we bail out due to an error; and they must also be able to
* prevent inlining.
*/
typedef enum FmgrHookEventType
{
FHET_START,
FHET_END,
FHET_ABORT
} FmgrHookEventType;
typedef bool (*needs_fmgr_hook_type) (Oid fn_oid);
typedef void (*fmgr_hook_type) (FmgrHookEventType event,
FmgrInfo *flinfo, Datum *arg);
extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook;
extern PGDLLIMPORT fmgr_hook_type fmgr_hook;
#define FmgrHookIsNeeded(fn_oid) \
(!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
/*
* !!! OLD INTERFACE !!!
*
* fmgr() is the only remaining vestige of the old-style caller support
* functions. It's no longer used anywhere in the Postgres distribution,
* but we should leave it around for a release or two to ease the transition
* for user-supplied C functions. OidFunctionCallN() replaces it for new
* code.
*/
/*
* DEPRECATED, DO NOT USE IN NEW CODE
*/
extern char *fmgr(Oid procedureId,...);
#endif /* FMGR_H */
# 718 "../../../../src/include/fmgr.h"
# 20 "../../../../src/include/access/skey.h" 2
/*
* A ScanKey represents the application of a comparison operator between
* a table or index column and a constant. When it's part of an array of
* ScanKeys, the comparison conditions are implicitly ANDed. The index
* column is the left argument of the operator, if it's a binary operator.
* (The data structure can support unary indexable operators too; in that
* case sk_argument would go unused. This is not currently implemented.)
*
* For an index scan, sk_strategy and sk_subtype must be set correctly for
* the operator. When using a ScanKey in a heap scan, these fields are not
* used and may be set to InvalidStrategy/InvalidOid.
*
* If the operator is collation-sensitive, sk_collation must be set
* correctly as well.
*
* A ScanKey can also represent a ScalarArrayOpExpr, that is a condition
* "column op ANY(ARRAY[...])". This is signaled by the SK_SEARCHARRAY
* flag bit. The sk_argument is not a value of the operator's right-hand
* argument type, but rather an array of such values, and the per-element
* comparisons are to be ORed together.
*
* A ScanKey can also represent a condition "column IS NULL" or "column
* IS NOT NULL"; these cases are signaled by the SK_SEARCHNULL and
* SK_SEARCHNOTNULL flag bits respectively. The argument is always NULL,
* and the sk_strategy, sk_subtype, sk_collation, and sk_func fields are
* not used (unless set by the index AM).
*
* SK_SEARCHARRAY, SK_SEARCHNULL and SK_SEARCHNOTNULL are supported only
* for index scans, not heap scans; and not all index AMs support them,
* only those that set amsearcharray or amsearchnulls respectively.
*
* A ScanKey can also represent an ordering operator invocation, that is
* an ordering requirement "ORDER BY indexedcol op constant". This looks
* the same as a comparison operator, except that the operator doesn't
* (usually) yield boolean. We mark such ScanKeys with SK_ORDER_BY.
* SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here.
*
* Note: in some places, ScanKeys are used as a convenient representation
* for the invocation of an access method support procedure. In this case
* sk_strategy/sk_subtype are not meaningful (but sk_collation can be); and
* sk_func may refer to a function that returns something other than boolean.
*/
typedef struct ScanKeyData
{
int sk_flags; /* flags, see below */
AttrNumber sk_attno; /* table or index column number */
StrategyNumber sk_strategy; /* operator strategy number */
Oid sk_subtype; /* strategy subtype */
Oid sk_collation; /* collation to use, if needed */
FmgrInfo sk_func; /* lookup info for function to call */
Datum sk_argument; /* data to compare */
} ScanKeyData;
typedef ScanKeyData *ScanKey;
/*
* About row comparisons:
*
* The ScanKey data structure also supports row comparisons, that is ordered
* tuple comparisons like (x, y) > (c1, c2), having the SQL-spec semantics
* "x > c1 OR (x = c1 AND y > c2)". Note that this is currently only
* implemented for btree index searches, not for heapscans or any other index
* type. A row comparison is represented by a "header" ScanKey entry plus
* a separate array of ScanKeys, one for each column of the row comparison.
* The header entry has these properties:
* sk_flags = SK_ROW_HEADER
* sk_attno = index column number for leading column of row comparison
* sk_strategy = btree strategy code for semantics of row comparison
* (ie, < <= > or >=)
* sk_subtype, sk_collation, sk_func: not used
* sk_argument: pointer to subsidiary ScanKey array
* If the header is part of a ScanKey array that's sorted by attno, it
* must be sorted according to the leading column number.
*
* The subsidiary ScanKey array appears in logical column order of the row
* comparison, which may be different from index column order. The array
* elements are like a normal ScanKey array except that:
* sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last
* element (needed since row header does not include a count)
* sk_func points to the btree comparison support function for the
* opclass, NOT the operator's implementation function.
* sk_strategy must be the same in all elements of the subsidiary array,
* that is, the same as in the header entry.
* SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here.
*/
/*
* ScanKeyData sk_flags
*
* sk_flags bits 0-15 are reserved for system-wide use (symbols for those
* bits should be defined here). Bits 16-31 are reserved for use within
* individual index access methods.
*/
#define SK_ISNULL 0x0001 /* sk_argument is NULL */
#define SK_UNARY 0x0002 /* unary operator (not supported!) */
#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */
#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */
#define SK_ROW_END 0x0010 /* last row comparison member */
#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */
#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */
#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT
* NULL" */
#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */
/*
* prototypes for functions in access/common/scankey.c
*/
extern void ScanKeyInit(ScanKey entry,
AttrNumber attributeNumber,
StrategyNumber strategy,
RegProcedure procedure,
Datum argument);
extern void ScanKeyEntryInitialize(ScanKey entry,
int flags,
AttrNumber attributeNumber,
StrategyNumber strategy,
Oid subtype,
Oid collation,
RegProcedure procedure,
Datum argument);
extern void ScanKeyEntryInitializeWithInfo(ScanKey entry,
int flags,
AttrNumber attributeNumber,
StrategyNumber strategy,
Oid subtype,
Oid collation,
FmgrInfo *finfo,
Datum argument);
#endif /* SKEY_H */
# 153 "../../../../src/include/access/skey.h"
# 19 "../../../../src/include/access/genam.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "nodes/tidbitmap.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/nodes/tidbitmap.h" 1
/*-------------------------------------------------------------------------
*
* tidbitmap.h
* PostgreSQL tuple-id (TID) bitmap package
*
* This module provides bitmap data structures that are spiritually
* similar to Bitmapsets, but are specially adapted to store sets of
* tuple identifiers (TIDs), or ItemPointers. In particular, the division
* of an ItemPointer into BlockNumber and OffsetNumber is catered for.
* Also, since we wish to be able to store very large tuple sets in
* memory with this data structure, we support "lossy" storage, in which
* we no longer remember individual tuple offsets on a page but only the
* fact that a particular page needs to be visited.
*
*
* Copyright (c) 2003-2016, PostgreSQL Global Development Group
*
* src/include/nodes/tidbitmap.h
*
*-------------------------------------------------------------------------
*/
#ifndef TIDBITMAP_H
#define TIDBITMAP_H
#if 0 /* expanded by -frewrite-includes */
#include "storage/itemptr.h"
#endif /* expanded by -frewrite-includes */
# 25 "../../../../src/include/nodes/tidbitmap.h"
# 1 "../../../../src/include/storage/itemptr.h" 1
/*-------------------------------------------------------------------------
*
* itemptr.h
* POSTGRES disk item pointer definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/itemptr.h
*
*-------------------------------------------------------------------------
*/
#ifndef ITEMPTR_H
#define ITEMPTR_H
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/storage/itemptr.h"
# 1 "../../../../src/include/storage/block.h" 1
/*-------------------------------------------------------------------------
*
* block.h
* POSTGRES disk block definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/block.h
*
*-------------------------------------------------------------------------
*/
#ifndef BLOCK_H
#define BLOCK_H
/*
* BlockNumber:
*
* each data file (heap or index) is divided into postgres disk blocks
* (which may be thought of as the unit of i/o -- a postgres buffer
* contains exactly one disk block). the blocks are numbered
* sequentially, 0 to 0xFFFFFFFE.
*
* InvalidBlockNumber is the same thing as P_NEW in buf.h.
*
* the access methods, the buffer manager and the storage manager are
* more or less the only pieces of code that should be accessing disk
* blocks directly.
*/
typedef uint32 BlockNumber;
#define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF)
#define MaxBlockNumber ((BlockNumber) 0xFFFFFFFE)
/*
* BlockId:
*
* this is a storage type for BlockNumber. in other words, this type
* is used for on-disk structures (e.g., in HeapTupleData) whereas
* BlockNumber is the type on which calculations are performed (e.g.,
* in access method code).
*
* there doesn't appear to be any reason to have separate types except
* for the fact that BlockIds can be SHORTALIGN'd (and therefore any
* structures that contains them, such as ItemPointerData, can also be
* SHORTALIGN'd). this is an important consideration for reducing the
* space requirements of the line pointer (ItemIdData) array on each
* page and the header of each heap or index tuple, so it doesn't seem
* wise to change this without good reason.
*/
typedef struct BlockIdData
{
uint16 bi_hi;
uint16 bi_lo;
} BlockIdData;
typedef BlockIdData *BlockId; /* block identifier */
/* ----------------
* support macros
* ----------------
*/
/*
* BlockNumberIsValid
* True iff blockNumber is valid.
*/
#define BlockNumberIsValid(blockNumber) \
((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber))
/*
* BlockIdIsValid
* True iff the block identifier is valid.
*/
#define BlockIdIsValid(blockId) \
((bool) PointerIsValid(blockId))
/*
* BlockIdSet
* Sets a block identifier to the specified value.
*/
#define BlockIdSet(blockId, blockNumber) \
( \
AssertMacro(PointerIsValid(blockId)), \
(blockId)->bi_hi = (blockNumber) >> 16, \
(blockId)->bi_lo = (blockNumber) & 0xffff \
)
/*
* BlockIdCopy
* Copy a block identifier.
*/
#define BlockIdCopy(toBlockId, fromBlockId) \
( \
AssertMacro(PointerIsValid(toBlockId)), \
AssertMacro(PointerIsValid(fromBlockId)), \
(toBlockId)->bi_hi = (fromBlockId)->bi_hi, \
(toBlockId)->bi_lo = (fromBlockId)->bi_lo \
)
/*
* BlockIdEquals
* Check for block number equality.
*/
#define BlockIdEquals(blockId1, blockId2) \
((blockId1)->bi_hi == (blockId2)->bi_hi && \
(blockId1)->bi_lo == (blockId2)->bi_lo)
/*
* BlockIdGetBlockNumber
* Retrieve the block number from a block identifier.
*/
#define BlockIdGetBlockNumber(blockId) \
( \
AssertMacro(BlockIdIsValid(blockId)), \
(BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \
)
#endif /* BLOCK_H */
# 122 "../../../../src/include/storage/block.h"
# 18 "../../../../src/include/storage/itemptr.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/off.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/storage/itemptr.h"
# 1 "../../../../src/include/storage/off.h" 1
/*-------------------------------------------------------------------------
*
* off.h
* POSTGRES disk "offset" definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/off.h
*
*-------------------------------------------------------------------------
*/
#ifndef OFF_H
#define OFF_H
#if 0 /* expanded by -frewrite-includes */
#include "storage/itemid.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/storage/off.h"
# 1 "../../../../src/include/storage/itemid.h" 1
/*-------------------------------------------------------------------------
*
* itemid.h
* Standard POSTGRES buffer page item identifier definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/itemid.h
*
*-------------------------------------------------------------------------
*/
#ifndef ITEMID_H
#define ITEMID_H
/*
* An item pointer (also called line pointer) on a buffer page
*
* In some cases an item pointer is "in use" but does not have any associated
* storage on the page. By convention, lp_len == 0 in every item pointer
* that does not have storage, independently of its lp_flags state.
*/
typedef struct ItemIdData
{
unsigned lp_off:15, /* offset to tuple (from start of page) */
lp_flags:2, /* state of item pointer, see below */
lp_len:15; /* byte length of tuple */
} ItemIdData;
typedef ItemIdData *ItemId;
/*
* lp_flags has these possible states. An UNUSED line pointer is available
* for immediate re-use, the other states are not.
*/
#define LP_UNUSED 0 /* unused (should always have lp_len=0) */
#define LP_NORMAL 1 /* used (should always have lp_len>0) */
#define LP_REDIRECT 2 /* HOT redirect (should have lp_len=0) */
#define LP_DEAD 3 /* dead, may or may not have storage */
/*
* Item offsets and lengths are represented by these types when
* they're not actually stored in an ItemIdData.
*/
typedef uint16 ItemOffset;
typedef uint16 ItemLength;
/* ----------------
* support macros
* ----------------
*/
/*
* ItemIdGetLength
*/
#define ItemIdGetLength(itemId) \
((itemId)->lp_len)
/*
* ItemIdGetOffset
*/
#define ItemIdGetOffset(itemId) \
((itemId)->lp_off)
/*
* ItemIdGetFlags
*/
#define ItemIdGetFlags(itemId) \
((itemId)->lp_flags)
/*
* ItemIdGetRedirect
* In a REDIRECT pointer, lp_off holds the link to the next item pointer
*/
#define ItemIdGetRedirect(itemId) \
((itemId)->lp_off)
/*
* ItemIdIsValid
* True iff item identifier is valid.
* This is a pretty weak test, probably useful only in Asserts.
*/
#define ItemIdIsValid(itemId) PointerIsValid(itemId)
/*
* ItemIdIsUsed
* True iff item identifier is in use.
*/
#define ItemIdIsUsed(itemId) \
((itemId)->lp_flags != LP_UNUSED)
/*
* ItemIdIsNormal
* True iff item identifier is in state NORMAL.
*/
#define ItemIdIsNormal(itemId) \
((itemId)->lp_flags == LP_NORMAL)
/*
* ItemIdIsRedirected
* True iff item identifier is in state REDIRECT.
*/
#define ItemIdIsRedirected(itemId) \
((itemId)->lp_flags == LP_REDIRECT)
/*
* ItemIdIsDead
* True iff item identifier is in state DEAD.
*/
#define ItemIdIsDead(itemId) \
((itemId)->lp_flags == LP_DEAD)
/*
* ItemIdHasStorage
* True iff item identifier has associated storage.
*/
#define ItemIdHasStorage(itemId) \
((itemId)->lp_len != 0)
/*
* ItemIdSetUnused
* Set the item identifier to be UNUSED, with no storage.
* Beware of multiple evaluations of itemId!
*/
#define ItemIdSetUnused(itemId) \
( \
(itemId)->lp_flags = LP_UNUSED, \
(itemId)->lp_off = 0, \
(itemId)->lp_len = 0 \
)
/*
* ItemIdSetNormal
* Set the item identifier to be NORMAL, with the specified storage.
* Beware of multiple evaluations of itemId!
*/
#define ItemIdSetNormal(itemId, off, len) \
( \
(itemId)->lp_flags = LP_NORMAL, \
(itemId)->lp_off = (off), \
(itemId)->lp_len = (len) \
)
/*
* ItemIdSetRedirect
* Set the item identifier to be REDIRECT, with the specified link.
* Beware of multiple evaluations of itemId!
*/
#define ItemIdSetRedirect(itemId, link) \
( \
(itemId)->lp_flags = LP_REDIRECT, \
(itemId)->lp_off = (link), \
(itemId)->lp_len = 0 \
)
/*
* ItemIdSetDead
* Set the item identifier to be DEAD, with no storage.
* Beware of multiple evaluations of itemId!
*/
#define ItemIdSetDead(itemId) \
( \
(itemId)->lp_flags = LP_DEAD, \
(itemId)->lp_off = 0, \
(itemId)->lp_len = 0 \
)
/*
* ItemIdMarkDead
* Set the item identifier to be DEAD, keeping its existing storage.
*
* Note: in indexes, this is used as if it were a hint-bit mechanism;
* we trust that multiple processors can do this in parallel and get
* the same result.
*/
#define ItemIdMarkDead(itemId) \
( \
(itemId)->lp_flags = LP_DEAD \
)
#endif /* ITEMID_H */
# 184 "../../../../src/include/storage/itemid.h"
# 18 "../../../../src/include/storage/off.h" 2
/*
* OffsetNumber:
*
* this is a 1-based index into the linp (ItemIdData) array in the
* header of each disk page.
*/
typedef uint16 OffsetNumber;
#define InvalidOffsetNumber ((OffsetNumber) 0)
#define FirstOffsetNumber ((OffsetNumber) 1)
#define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData)))
#define OffsetNumberMask (0xffff) /* valid uint16 bits */
/* ----------------
* support macros
* ----------------
*/
/*
* OffsetNumberIsValid
* True iff the offset number is valid.
*/
#define OffsetNumberIsValid(offsetNumber) \
((bool) ((offsetNumber != InvalidOffsetNumber) && \
(offsetNumber <= MaxOffsetNumber)))
/*
* OffsetNumberNext
* OffsetNumberPrev
* Increments/decrements the argument. These macros look pointless
* but they help us disambiguate the different manipulations on
* OffsetNumbers (e.g., sometimes we subtract one from an
* OffsetNumber to move back, and sometimes we do so to form a
* real C array index).
*/
#define OffsetNumberNext(offsetNumber) \
((OffsetNumber) (1 + (offsetNumber)))
#define OffsetNumberPrev(offsetNumber) \
((OffsetNumber) (-1 + (offsetNumber)))
#endif /* OFF_H */
# 59 "../../../../src/include/storage/off.h"
# 19 "../../../../src/include/storage/itemptr.h" 2
/*
* ItemPointer:
*
* This is a pointer to an item within a disk page of a known file
* (for example, a cross-link from an index to its parent table).
* blkid tells us which block, posid tells us which entry in the linp
* (ItemIdData) array we want.
*
* Note: because there is an item pointer in each tuple header and index
* tuple header on disk, it's very important not to waste space with
* structure padding bytes. The struct is designed to be six bytes long
* (it contains three int16 fields) but a few compilers will pad it to
* eight bytes unless coerced. We apply appropriate persuasion where
* possible, and to cope with unpersuadable compilers, we try to use
* "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing
* on-disk sizes.
*/
typedef struct ItemPointerData
{
BlockIdData ip_blkid;
OffsetNumber ip_posid;
}
/* If compiler understands packed and aligned pragmas, use those */
#if defined(pg_attribute_packed) && defined(pg_attribute_aligned)
pg_attribute_packed()
pg_attribute_aligned(2)
#endif
# 47 "../../../../src/include/storage/itemptr.h"
ItemPointerData;
#define SizeOfIptrData \
(offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))
typedef ItemPointerData *ItemPointer;
/* ----------------
* support macros
* ----------------
*/
/*
* ItemPointerIsValid
* True iff the disk item pointer is not NULL.
*/
#define ItemPointerIsValid(pointer) \
((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0)))
/*
* ItemPointerGetBlockNumber
* Returns the block number of a disk item pointer.
*/
#define ItemPointerGetBlockNumber(pointer) \
( \
AssertMacro(ItemPointerIsValid(pointer)), \
BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
)
/*
* ItemPointerGetOffsetNumber
* Returns the offset number of a disk item pointer.
*/
#define ItemPointerGetOffsetNumber(pointer) \
( \
AssertMacro(ItemPointerIsValid(pointer)), \
(pointer)->ip_posid \
)
/*
* ItemPointerSet
* Sets a disk item pointer to the specified block and offset.
*/
#define ItemPointerSet(pointer, blockNumber, offNum) \
( \
AssertMacro(PointerIsValid(pointer)), \
BlockIdSet(&((pointer)->ip_blkid), blockNumber), \
(pointer)->ip_posid = offNum \
)
/*
* ItemPointerSetBlockNumber
* Sets a disk item pointer to the specified block.
*/
#define ItemPointerSetBlockNumber(pointer, blockNumber) \
( \
AssertMacro(PointerIsValid(pointer)), \
BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
)
/*
* ItemPointerSetOffsetNumber
* Sets a disk item pointer to the specified offset.
*/
#define ItemPointerSetOffsetNumber(pointer, offsetNumber) \
( \
AssertMacro(PointerIsValid(pointer)), \
(pointer)->ip_posid = (offsetNumber) \
)
/*
* ItemPointerCopy
* Copies the contents of one disk item pointer to another.
*
* Should there ever be padding in an ItemPointer this would need to be handled
* differently as it's used as hash key.
*/
#define ItemPointerCopy(fromPointer, toPointer) \
( \
AssertMacro(PointerIsValid(toPointer)), \
AssertMacro(PointerIsValid(fromPointer)), \
*(toPointer) = *(fromPointer) \
)
/*
* ItemPointerSetInvalid
* Sets a disk item pointer to be invalid.
*/
#define ItemPointerSetInvalid(pointer) \
( \
AssertMacro(PointerIsValid(pointer)), \
BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \
(pointer)->ip_posid = InvalidOffsetNumber \
)
/* ----------------
* externs
* ----------------
*/
extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2);
extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2);
#endif /* ITEMPTR_H */
# 151 "../../../../src/include/storage/itemptr.h"
# 26 "../../../../src/include/nodes/tidbitmap.h" 2
/*
* Actual bitmap representation is private to tidbitmap.c. Callers can
* do IsA(x, TIDBitmap) on it, but nothing else.
*/
typedef struct TIDBitmap TIDBitmap;
/* Likewise, TBMIterator is private */
typedef struct TBMIterator TBMIterator;
/* Result structure for tbm_iterate */
typedef struct
{
BlockNumber blockno; /* page number containing tuples */
int ntuples; /* -1 indicates lossy result */
bool recheck; /* should the tuples be rechecked? */
/* Note: recheck is always true if ntuples < 0 */
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} TBMIterateResult;
/* function prototypes in nodes/tidbitmap.c */
extern TIDBitmap *tbm_create(long maxbytes);
extern void tbm_free(TIDBitmap *tbm);
extern void tbm_add_tuples(TIDBitmap *tbm,
const ItemPointer tids, int ntids,
bool recheck);
extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno);
extern void tbm_union(TIDBitmap *a, const TIDBitmap *b);
extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b);
extern bool tbm_is_empty(const TIDBitmap *tbm);
extern TBMIterator *tbm_begin_iterate(TIDBitmap *tbm);
extern TBMIterateResult *tbm_iterate(TBMIterator *iterator);
extern void tbm_end_iterate(TBMIterator *iterator);
#endif /* TIDBITMAP_H */
# 67 "../../../../src/include/nodes/tidbitmap.h"
# 20 "../../../../src/include/access/genam.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/lockdefs.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/storage/lockdefs.h" 1
/*-------------------------------------------------------------------------
*
* lockdefs.h
* Frontend exposed parts of postgres' low level lock mechanism
*
* The split between lockdefs.h and lock.h is not very principled. This file
* contains definition that have to (indirectly) be available when included by
* FRONTEND code.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/lockdefs.h
*
*-------------------------------------------------------------------------
*/
#ifndef LOCKDEFS_H_
#define LOCKDEFS_H_
/*
* LOCKMODE is an integer (1..N) indicating a lock type. LOCKMASK is a bit
* mask indicating a set of held or requested lock types (the bit 1<<mode
* corresponds to a particular lock mode).
*/
typedef int LOCKMASK;
typedef int LOCKMODE;
/*
* These are the valid values of type LOCKMODE for all the standard lock
* methods (both DEFAULT and USER).
*/
/* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */
#define NoLock 0
#define AccessShareLock 1 /* SELECT */
#define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */
#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */
#define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL),ANALYZE, CREATE
* INDEX CONCURRENTLY */
#define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */
#define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows ROW
* SHARE */
#define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR
* UPDATE */
#define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM
* FULL, and unqualified LOCK TABLE */
typedef struct xl_standby_lock
{
TransactionId xid; /* xid of holder of AccessExclusiveLock */
Oid dbOid;
Oid relOid;
} xl_standby_lock;
#endif /* LOCKDEF_H_ */
# 57 "../../../../src/include/storage/lockdefs.h"
# 21 "../../../../src/include/access/genam.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/relcache.h"
#endif /* expanded by -frewrite-includes */
# 21 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/utils/relcache.h" 1
/*-------------------------------------------------------------------------
*
* relcache.h
* Relation descriptor cache definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/relcache.h
*
*-------------------------------------------------------------------------
*/
#ifndef RELCACHE_H
#define RELCACHE_H
#if 0 /* expanded by -frewrite-includes */
#include "access/tupdesc.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/utils/relcache.h"
# 1 "../../../../src/include/access/tupdesc.h" 1
/*-------------------------------------------------------------------------
*
* tupdesc.h
* POSTGRES tuple descriptor definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/tupdesc.h
*
*-------------------------------------------------------------------------
*/
#ifndef TUPDESC_H
#define TUPDESC_H
#if 0 /* expanded by -frewrite-includes */
#include "access/attnum.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/tupdesc.h"
# 18 "../../../../src/include/access/tupdesc.h"
#if 0 /* expanded by -frewrite-includes */
#include "catalog/pg_attribute.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/tupdesc.h"
# 1 "../../../../src/include/catalog/pg_attribute.h" 1
/*-------------------------------------------------------------------------
*
* pg_attribute.h
* definition of the system "attribute" relation (pg_attribute)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_attribute.h
*
* NOTES
* the genbki.pl script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_ATTRIBUTE_H
#define PG_ATTRIBUTE_H
#if 0 /* expanded by -frewrite-includes */
#include "catalog/genbki.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/catalog/pg_attribute.h"
# 1 "../../../../src/include/catalog/genbki.h" 1
/*-------------------------------------------------------------------------
*
* genbki.h
* Required include file for all POSTGRES catalog header files
*
* genbki.h defines CATALOG(), DATA(), BKI_BOOTSTRAP and related macros
* so that the catalog header files can be read by the C compiler.
* (These same words are recognized by genbki.pl to build the BKI
* bootstrap file from these header files.)
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/genbki.h
*
*-------------------------------------------------------------------------
*/
#ifndef GENBKI_H
#define GENBKI_H
/* Introduces a catalog's structure definition */
#define CATALOG(name,oid) typedef struct CppConcat(FormData_,name)
/* Options that may appear after CATALOG (on the same line) */
#define BKI_BOOTSTRAP
#define BKI_SHARED_RELATION
#define BKI_WITHOUT_OIDS
#define BKI_ROWTYPE_OID(oid)
#define BKI_SCHEMA_MACRO
#define BKI_FORCE_NULL
#define BKI_FORCE_NOT_NULL
/*
* This is never defined; it's here only for documentation.
*
* Variable-length catalog fields (except possibly the first not nullable one)
* should not be visible in C structures, so they are made invisible by #ifdefs
* of an undefined symbol. See also MARKNOTNULL in bootstrap.c for how this is
* handled.
*/
#undef CATALOG_VARLEN
/* Declarations that provide the initial content of a catalog */
/* In C, these need to expand into some harmless, repeatable declaration */
#define DATA(x) extern int no_such_variable
#define DESCR(x) extern int no_such_variable
#define SHDESCR(x) extern int no_such_variable
#endif /* GENBKI_H */
# 51 "../../../../src/include/catalog/genbki.h"
# 23 "../../../../src/include/catalog/pg_attribute.h" 2
/* ----------------
* pg_attribute definition. cpp turns this into
* typedef struct FormData_pg_attribute
*
* If you change the following, make sure you change the structs for
* system attributes in catalog/heap.c also.
* You may need to change catalog/genbki.pl as well.
* ----------------
*/
#define AttributeRelationId 1249
#define AttributeRelation_Rowtype_Id 75
CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BKI_SCHEMA_MACRO
{
Oid attrelid; /* OID of relation containing this attribute */
NameData attname; /* name of attribute */
/*
* atttypid is the OID of the instance in Catalog Class pg_type that
* defines the data type of this attribute (e.g. int4). Information in
* that instance is redundant with the attlen, attbyval, and attalign
* attributes of this instance, so they had better match or Postgres will
* fail.
*/
Oid atttypid;
/*
* attstattarget is the target number of statistics datapoints to collect
* during VACUUM ANALYZE of this column. A zero here indicates that we do
* not wish to collect any stats about this column. A "-1" here indicates
* that no value has been explicitly set for this column, so ANALYZE
* should use the default setting.
*/
int32 attstattarget;
/*
* attlen is a copy of the typlen field from pg_type for this attribute.
* See atttypid comments above.
*/
int16 attlen;
/*
* attnum is the "attribute number" for the attribute: A value that
* uniquely identifies this attribute within its class. For user
* attributes, Attribute numbers are greater than 0 and not greater than
* the number of attributes in the class. I.e. if the Class pg_class says
* that Class XYZ has 10 attributes, then the user attribute numbers in
* Class pg_attribute must be 1-10.
*
* System attributes have attribute numbers less than 0 that are unique
* within the class, but not constrained to any particular range.
*
* Note that (attnum - 1) is often used as the index to an array.
*/
int16 attnum;
/*
* attndims is the declared number of dimensions, if an array type,
* otherwise zero.
*/
int32 attndims;
/*
* fastgetattr() uses attcacheoff to cache byte offsets of attributes in
* heap tuples. The value actually stored in pg_attribute (-1) indicates
* no cached value. But when we copy these tuples into a tuple
* descriptor, we may then update attcacheoff in the copies. This speeds
* up the attribute walking process.
*/
int32 attcacheoff;
/*
* atttypmod records type-specific data supplied at table creation time
* (for example, the max length of a varchar field). It is passed to
* type-specific input and output functions as the third argument. The
* value will generally be -1 for types that do not need typmod.
*/
int32 atttypmod;
/*
* attbyval is a copy of the typbyval field from pg_type for this
* attribute. See atttypid comments above.
*/
bool attbyval;
/*----------
* attstorage tells for VARLENA attributes, what the heap access
* methods can do to it if a given tuple doesn't fit into a page.
* Possible values are
* 'p': Value must be stored plain always
* 'e': Value can be stored in "secondary" relation (if relation
* has one, see pg_class.reltoastrelid)
* 'm': Value can be stored compressed inline
* 'x': Value can be stored compressed inline or in "secondary"
* Note that 'm' fields can also be moved out to secondary storage,
* but only as a last resort ('e' and 'x' fields are moved first).
*----------
*/
char attstorage;
/*
* attalign is a copy of the typalign field from pg_type for this
* attribute. See atttypid comments above.
*/
char attalign;
/* This flag represents the "NOT NULL" constraint */
bool attnotnull;
/* Has DEFAULT value or not */
bool atthasdef;
/* Is dropped (ie, logically invisible) or not */
bool attisdropped;
/*
* This flag specifies whether this column has ever had a local
* definition. It is set for normal non-inherited columns, but also for
* columns that are inherited from parents if also explicitly listed in
* CREATE TABLE INHERITS. It is also set when inheritance is removed from
* a table with ALTER TABLE NO INHERIT. If the flag is set, the column is
* not dropped by a parent's DROP COLUMN even if this causes the column's
* attinhcount to become zero.
*/
bool attislocal;
/* Number of times inherited from direct parent relation(s) */
int32 attinhcount;
/* attribute's collation */
Oid attcollation;
#ifdef CATALOG_VARLEN /* variable-length fields start here */
/* NOTE: The following fields are not present in tuple descriptors. */
/* Column-level access permissions */
aclitem attacl[1];
/* Column-level options */
text attoptions[1];
/* Column-level FDW options */
text attfdwoptions[1];
#endif
# 168 "../../../../src/include/catalog/pg_attribute.h"
} FormData_pg_attribute;
/*
* ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout,
* guaranteed-not-null part of a pg_attribute row. This is in fact as much
* of the row as gets copied into tuple descriptors, so don't expect you
* can access fields beyond attcollation except in a real tuple!
*/
#define ATTRIBUTE_FIXED_PART_SIZE \
(offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid))
/* ----------------
* Form_pg_attribute corresponds to a pointer to a tuple with
* the format of pg_attribute relation.
* ----------------
*/
typedef FormData_pg_attribute *Form_pg_attribute;
/* ----------------
* compiler constants for pg_attribute
* ----------------
*/
#define Natts_pg_attribute 21
#define Anum_pg_attribute_attrelid 1
#define Anum_pg_attribute_attname 2
#define Anum_pg_attribute_atttypid 3
#define Anum_pg_attribute_attstattarget 4
#define Anum_pg_attribute_attlen 5
#define Anum_pg_attribute_attnum 6
#define Anum_pg_attribute_attndims 7
#define Anum_pg_attribute_attcacheoff 8
#define Anum_pg_attribute_atttypmod 9
#define Anum_pg_attribute_attbyval 10
#define Anum_pg_attribute_attstorage 11
#define Anum_pg_attribute_attalign 12
#define Anum_pg_attribute_attnotnull 13
#define Anum_pg_attribute_atthasdef 14
#define Anum_pg_attribute_attisdropped 15
#define Anum_pg_attribute_attislocal 16
#define Anum_pg_attribute_attinhcount 17
#define Anum_pg_attribute_attcollation 18
#define Anum_pg_attribute_attacl 19
#define Anum_pg_attribute_attoptions 20
#define Anum_pg_attribute_attfdwoptions 21
/* ----------------
* initial contents of pg_attribute
*
* The initial contents of pg_attribute are generated at compile time by
* genbki.pl. Only "bootstrapped" relations need be included.
* ----------------
*/
#endif /* PG_ATTRIBUTE_H */
# 224 "../../../../src/include/catalog/pg_attribute.h"
# 19 "../../../../src/include/access/tupdesc.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "nodes/pg_list.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/tupdesc.h"
# 1 "../../../../src/include/nodes/pg_list.h" 1
/*-------------------------------------------------------------------------
*
* pg_list.h
* interface for PostgreSQL generic linked list package
*
* This package implements singly-linked homogeneous lists.
*
* It is important to have constant-time length, append, and prepend
* operations. To achieve this, we deal with two distinct data
* structures:
*
* 1. A set of "list cells": each cell contains a data field and
* a link to the next cell in the list or NULL.
* 2. A single structure containing metadata about the list: the
* type of the list, pointers to the head and tail cells, and
* the length of the list.
*
* We support three types of lists:
*
* T_List: lists of pointers
* (in practice usually pointers to Nodes, but not always;
* declared as "void *" to minimize casting annoyances)
* T_IntList: lists of integers
* T_OidList: lists of Oids
*
* (At the moment, ints and Oids are the same size, but they may not
* always be so; try to be careful to maintain the distinction.)
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/pg_list.h
*
*-------------------------------------------------------------------------
*/
#ifndef PG_LIST_H
#define PG_LIST_H
#if 0 /* expanded by -frewrite-includes */
#include "nodes/nodes.h"
#endif /* expanded by -frewrite-includes */
# 40 "../../../../src/include/nodes/pg_list.h"
# 1 "../../../../src/include/nodes/nodes.h" 1
/*-------------------------------------------------------------------------
*
* nodes.h
* Definitions for tagged nodes.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/nodes.h
*
*-------------------------------------------------------------------------
*/
#ifndef NODES_H
#define NODES_H
/*
* The first field of every node is NodeTag. Each node created (with makeNode)
* will have one of the following tags as the value of its first field.
*
* Note that the numbers of the node tags are not contiguous. We left holes
* here so that we can add more tags without changing the existing enum's.
* (Since node tag numbers never exist outside backend memory, there's no
* real harm in renumbering, it just costs a full rebuild ...)
*/
typedef enum NodeTag
{
T_Invalid = 0,
/*
* TAGS FOR EXECUTOR NODES (execnodes.h)
*/
T_IndexInfo = 10,
T_ExprContext,
T_ProjectionInfo,
T_JunkFilter,
T_ResultRelInfo,
T_EState,
T_TupleTableSlot,
/*
* TAGS FOR PLAN NODES (plannodes.h)
*/
T_Plan = 100,
T_Result,
T_ModifyTable,
T_Append,
T_MergeAppend,
T_RecursiveUnion,
T_BitmapAnd,
T_BitmapOr,
T_Scan,
T_SeqScan,
T_SampleScan,
T_IndexScan,
T_IndexOnlyScan,
T_BitmapIndexScan,
T_BitmapHeapScan,
T_TidScan,
T_SubqueryScan,
T_FunctionScan,
T_ValuesScan,
T_CteScan,
T_WorkTableScan,
T_ForeignScan,
T_CustomScan,
T_Join,
T_NestLoop,
T_MergeJoin,
T_HashJoin,
T_Material,
T_Sort,
T_Group,
T_Agg,
T_WindowAgg,
T_Unique,
T_Gather,
T_Hash,
T_SetOp,
T_LockRows,
T_Limit,
/* these aren't subclasses of Plan: */
T_NestLoopParam,
T_PlanRowMark,
T_PlanInvalItem,
/*
* TAGS FOR PLAN STATE NODES (execnodes.h)
*
* These should correspond one-to-one with Plan node types.
*/
T_PlanState = 200,
T_ResultState,
T_ModifyTableState,
T_AppendState,
T_MergeAppendState,
T_RecursiveUnionState,
T_BitmapAndState,
T_BitmapOrState,
T_ScanState,
T_SeqScanState,
T_SampleScanState,
T_IndexScanState,
T_IndexOnlyScanState,
T_BitmapIndexScanState,
T_BitmapHeapScanState,
T_TidScanState,
T_SubqueryScanState,
T_FunctionScanState,
T_ValuesScanState,
T_CteScanState,
T_WorkTableScanState,
T_ForeignScanState,
T_CustomScanState,
T_JoinState,
T_NestLoopState,
T_MergeJoinState,
T_HashJoinState,
T_MaterialState,
T_SortState,
T_GroupState,
T_AggState,
T_WindowAggState,
T_UniqueState,
T_GatherState,
T_HashState,
T_SetOpState,
T_LockRowsState,
T_LimitState,
/*
* TAGS FOR PRIMITIVE NODES (primnodes.h)
*/
T_Alias = 300,
T_RangeVar,
T_Expr,
T_Var,
T_Const,
T_Param,
T_Aggref,
T_GroupingFunc,
T_WindowFunc,
T_ArrayRef,
T_FuncExpr,
T_NamedArgExpr,
T_OpExpr,
T_DistinctExpr,
T_NullIfExpr,
T_ScalarArrayOpExpr,
T_BoolExpr,
T_SubLink,
T_SubPlan,
T_AlternativeSubPlan,
T_FieldSelect,
T_FieldStore,
T_RelabelType,
T_CoerceViaIO,
T_ArrayCoerceExpr,
T_ConvertRowtypeExpr,
T_CollateExpr,
T_CaseExpr,
T_CaseWhen,
T_CaseTestExpr,
T_ArrayExpr,
T_RowExpr,
T_RowCompareExpr,
T_CoalesceExpr,
T_MinMaxExpr,
T_XmlExpr,
T_NullTest,
T_BooleanTest,
T_CoerceToDomain,
T_CoerceToDomainValue,
T_SetToDefault,
T_CurrentOfExpr,
T_InferenceElem,
T_TargetEntry,
T_RangeTblRef,
T_JoinExpr,
T_FromExpr,
T_OnConflictExpr,
T_IntoClause,
/*
* TAGS FOR EXPRESSION STATE NODES (execnodes.h)
*
* These correspond (not always one-for-one) to primitive nodes derived
* from Expr.
*/
T_ExprState = 400,
T_GenericExprState,
T_WholeRowVarExprState,
T_AggrefExprState,
T_GroupingFuncExprState,
T_WindowFuncExprState,
T_ArrayRefExprState,
T_FuncExprState,
T_ScalarArrayOpExprState,
T_BoolExprState,
T_SubPlanState,
T_AlternativeSubPlanState,
T_FieldSelectState,
T_FieldStoreState,
T_CoerceViaIOState,
T_ArrayCoerceExprState,
T_ConvertRowtypeExprState,
T_CaseExprState,
T_CaseWhenState,
T_ArrayExprState,
T_RowExprState,
T_RowCompareExprState,
T_CoalesceExprState,
T_MinMaxExprState,
T_XmlExprState,
T_NullTestState,
T_CoerceToDomainState,
T_DomainConstraintState,
/*
* TAGS FOR PLANNER NODES (relation.h)
*/
T_PlannerInfo = 500,
T_PlannerGlobal,
T_RelOptInfo,
T_IndexOptInfo,
T_ForeignKeyOptInfo,
T_ParamPathInfo,
T_Path,
T_IndexPath,
T_BitmapHeapPath,
T_BitmapAndPath,
T_BitmapOrPath,
T_TidPath,
T_SubqueryScanPath,
T_ForeignPath,
T_CustomPath,
T_NestPath,
T_MergePath,
T_HashPath,
T_AppendPath,
T_MergeAppendPath,
T_ResultPath,
T_MaterialPath,
T_UniquePath,
T_GatherPath,
T_ProjectionPath,
T_SortPath,
T_GroupPath,
T_UpperUniquePath,
T_AggPath,
T_GroupingSetsPath,
T_MinMaxAggPath,
T_WindowAggPath,
T_SetOpPath,
T_RecursiveUnionPath,
T_LockRowsPath,
T_ModifyTablePath,
T_LimitPath,
/* these aren't subclasses of Path: */
T_EquivalenceClass,
T_EquivalenceMember,
T_PathKey,
T_PathTarget,
T_RestrictInfo,
T_PlaceHolderVar,
T_SpecialJoinInfo,
T_AppendRelInfo,
T_PlaceHolderInfo,
T_MinMaxAggInfo,
T_PlannerParamItem,
/*
* TAGS FOR MEMORY NODES (memnodes.h)
*/
T_MemoryContext = 600,
T_AllocSetContext,
/*
* TAGS FOR VALUE NODES (value.h)
*/
T_Value = 650,
T_Integer,
T_Float,
T_String,
T_BitString,
T_Null,
/*
* TAGS FOR LIST NODES (pg_list.h)
*/
T_List,
T_IntList,
T_OidList,
/*
* TAGS FOR EXTENSIBLE NODES (extensible.h)
*/
T_ExtensibleNode,
/*
* TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
*/
T_Query = 700,
T_PlannedStmt,
T_InsertStmt,
T_DeleteStmt,
T_UpdateStmt,
T_SelectStmt,
T_AlterTableStmt,
T_AlterTableCmd,
T_AlterDomainStmt,
T_SetOperationStmt,
T_GrantStmt,
T_GrantRoleStmt,
T_AlterDefaultPrivilegesStmt,
T_ClosePortalStmt,
T_ClusterStmt,
T_CopyStmt,
T_CreateStmt,
T_DefineStmt,
T_DropStmt,
T_TruncateStmt,
T_CommentStmt,
T_FetchStmt,
T_IndexStmt,
T_CreateFunctionStmt,
T_AlterFunctionStmt,
T_DoStmt,
T_RenameStmt,
T_RuleStmt,
T_NotifyStmt,
T_ListenStmt,
T_UnlistenStmt,
T_TransactionStmt,
T_ViewStmt,
T_LoadStmt,
T_CreateDomainStmt,
T_CreatedbStmt,
T_DropdbStmt,
T_VacuumStmt,
T_ExplainStmt,
T_CreateTableAsStmt,
T_CreateSeqStmt,
T_AlterSeqStmt,
T_VariableSetStmt,
T_VariableShowStmt,
T_DiscardStmt,
T_CreateTrigStmt,
T_CreatePLangStmt,
T_CreateRoleStmt,
T_AlterRoleStmt,
T_DropRoleStmt,
T_LockStmt,
T_ConstraintsSetStmt,
T_ReindexStmt,
T_CheckPointStmt,
T_CreateSchemaStmt,
T_AlterDatabaseStmt,
T_AlterDatabaseSetStmt,
T_AlterRoleSetStmt,
T_CreateConversionStmt,
T_CreateCastStmt,
T_CreateOpClassStmt,
T_CreateOpFamilyStmt,
T_AlterOpFamilyStmt,
T_PrepareStmt,
T_ExecuteStmt,
T_DeallocateStmt,
T_DeclareCursorStmt,
T_CreateTableSpaceStmt,
T_DropTableSpaceStmt,
T_AlterObjectDependsStmt,
T_AlterObjectSchemaStmt,
T_AlterOwnerStmt,
T_AlterOperatorStmt,
T_DropOwnedStmt,
T_ReassignOwnedStmt,
T_CompositeTypeStmt,
T_CreateEnumStmt,
T_CreateRangeStmt,
T_AlterEnumStmt,
T_AlterTSDictionaryStmt,
T_AlterTSConfigurationStmt,
T_CreateFdwStmt,
T_AlterFdwStmt,
T_CreateForeignServerStmt,
T_AlterForeignServerStmt,
T_CreateUserMappingStmt,
T_AlterUserMappingStmt,
T_DropUserMappingStmt,
T_AlterTableSpaceOptionsStmt,
T_AlterTableMoveAllStmt,
T_SecLabelStmt,
T_CreateForeignTableStmt,
T_ImportForeignSchemaStmt,
T_CreateExtensionStmt,
T_AlterExtensionStmt,
T_AlterExtensionContentsStmt,
T_CreateEventTrigStmt,
T_AlterEventTrigStmt,
T_RefreshMatViewStmt,
T_ReplicaIdentityStmt,
T_AlterSystemStmt,
T_CreatePolicyStmt,
T_AlterPolicyStmt,
T_CreateTransformStmt,
T_CreateAmStmt,
/*
* TAGS FOR PARSE TREE NODES (parsenodes.h)
*/
T_A_Expr = 900,
T_ColumnRef,
T_ParamRef,
T_A_Const,
T_FuncCall,
T_A_Star,
T_A_Indices,
T_A_Indirection,
T_A_ArrayExpr,
T_ResTarget,
T_MultiAssignRef,
T_TypeCast,
T_CollateClause,
T_SortBy,
T_WindowDef,
T_RangeSubselect,
T_RangeFunction,
T_RangeTableSample,
T_TypeName,
T_ColumnDef,
T_IndexElem,
T_Constraint,
T_DefElem,
T_RangeTblEntry,
T_RangeTblFunction,
T_TableSampleClause,
T_WithCheckOption,
T_SortGroupClause,
T_GroupingSet,
T_WindowClause,
T_FuncWithArgs,
T_AccessPriv,
T_CreateOpClassItem,
T_TableLikeClause,
T_FunctionParameter,
T_LockingClause,
T_RowMarkClause,
T_XmlSerialize,
T_WithClause,
T_InferClause,
T_OnConflictClause,
T_CommonTableExpr,
T_RoleSpec,
/*
* TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h)
*/
T_IdentifySystemCmd,
T_BaseBackupCmd,
T_CreateReplicationSlotCmd,
T_DropReplicationSlotCmd,
T_StartReplicationCmd,
T_TimeLineHistoryCmd,
/*
* TAGS FOR RANDOM OTHER STUFF
*
* These are objects that aren't part of parse/plan/execute node tree
* structures, but we give them NodeTags anyway for identification
* purposes (usually because they are involved in APIs where we want to
* pass multiple object types through the same pointer).
*/
T_TriggerData = 950, /* in commands/trigger.h */
T_EventTriggerData, /* in commands/event_trigger.h */
T_ReturnSetInfo, /* in nodes/execnodes.h */
T_WindowObjectData, /* private in nodeWindowAgg.c */
T_TIDBitmap, /* in nodes/tidbitmap.h */
T_InlineCodeBlock, /* in nodes/parsenodes.h */
T_FdwRoutine, /* in foreign/fdwapi.h */
T_IndexAmRoutine, /* in access/amapi.h */
T_TsmRoutine, /* in access/tsmapi.h */
T_ForeignKeyCacheInfo /* in utils/rel.h */
} NodeTag;
/*
* The first field of a node of any type is guaranteed to be the NodeTag.
* Hence the type of any node can be gotten by casting it to Node. Declaring
* a variable to be of Node * (instead of void *) can also facilitate
* debugging.
*/
typedef struct Node
{
NodeTag type;
} Node;
#define nodeTag(nodeptr) (((const Node*)(nodeptr))->type)
/*
* newNode -
* create a new node of the specified size and tag the node with the
* specified tag.
*
* !WARNING!: Avoid using newNode directly. You should be using the
* macro makeNode. eg. to create a Query node, use makeNode(Query)
*
* Note: the size argument should always be a compile-time constant, so the
* apparent risk of multiple evaluation doesn't matter in practice.
*/
#ifdef __GNUC__
/* With GCC, we can use a compound statement within an expression */
#define newNode(size, tag) \
({ Node *_result; \
AssertMacro((size) >= sizeof(Node)); /* need the tag, at least */ \
_result = (Node *) palloc0fast(size); \
_result->type = (tag); \
_result; \
})
#else
# 521 "../../../../src/include/nodes/nodes.h"
/*
* There is no way to dereference the palloc'ed pointer to assign the
* tag, and also return the pointer itself, so we need a holder variable.
* Fortunately, this macro isn't recursive so we just define
* a global variable for this purpose.
*/
extern PGDLLIMPORT Node *newNodeMacroHolder;
#define newNode(size, tag) \
( \
AssertMacro((size) >= sizeof(Node)), /* need the tag, at least */ \
newNodeMacroHolder = (Node *) palloc0fast(size), \
newNodeMacroHolder->type = (tag), \
newNodeMacroHolder \
)
#endif /* __GNUC__ */
# 538 "../../../../src/include/nodes/nodes.h"
#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t))
#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_)
/*
* castNode(type, ptr) casts ptr to "type *", and if assertions are enabled,
* verifies that the node has the appropriate type (using its nodeTag()).
*
* Use an inline function when assertions are enabled, to avoid multiple
* evaluations of the ptr argument (which could e.g. be a function call).
*/
#ifdef USE_ASSERT_CHECKING
static inline Node *
castNodeImpl(NodeTag type, void *ptr)
{
Assert(ptr == NULL || nodeTag(ptr) == type);
return (Node *) ptr;
}
#define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr))
#else
# 561 "../../../../src/include/nodes/nodes.h"
#define castNode(_type_, nodeptr) ((_type_ *) (nodeptr))
#endif /* USE_ASSERT_CHECKING */
# 563 "../../../../src/include/nodes/nodes.h"
/* ----------------------------------------------------------------
* extern declarations follow
* ----------------------------------------------------------------
*/
/*
* nodes/{outfuncs.c,print.c}
*/
extern char *nodeToString(const void *obj);
struct Bitmapset; /* not to include bitmapset.h here */
struct StringInfoData; /* not to include stringinfo.h here */
extern void outNode(struct StringInfoData *str, const void *obj);
extern void outToken(struct StringInfoData *str, const char *s);
extern void outBitmapset(struct StringInfoData *str,
const struct Bitmapset *bms);
extern void outDatum(struct StringInfoData *str, uintptr_t value,
int typlen, bool typbyval);
/*
* nodes/{readfuncs.c,read.c}
*/
extern void *stringToNode(char *str);
extern struct Bitmapset *readBitmapset(void);
extern uintptr_t readDatum(bool typbyval);
extern bool *readBoolCols(int numCols);
extern int *readIntCols(int numCols);
extern Oid *readOidCols(int numCols);
extern int16 *readAttrNumberCols(int numCols);
/*
* nodes/copyfuncs.c
*/
extern void *copyObject(const void *obj);
/*
* nodes/equalfuncs.c
*/
extern bool equal(const void *a, const void *b);
/*
* Typedefs for identifying qualifier selectivities and plan costs as such.
* These are just plain "double"s, but declaring a variable as Selectivity
* or Cost makes the intent more obvious.
*
* These could have gone into plannodes.h or some such, but many files
* depend on them...
*/
typedef double Selectivity; /* fraction of tuples a qualifier will pass */
typedef double Cost; /* execution cost (in page-access units) */
/*
* CmdType -
* enums for type of operation represented by a Query or PlannedStmt
*
* This is needed in both parsenodes.h and plannodes.h, so put it here...
*/
typedef enum CmdType
{
CMD_UNKNOWN,
CMD_SELECT, /* select stmt */
CMD_UPDATE, /* update stmt */
CMD_INSERT, /* insert stmt */
CMD_DELETE,
CMD_UTILITY, /* cmds like create, destroy, copy, vacuum,
* etc. */
CMD_NOTHING /* dummy command for instead nothing rules
* with qual */
} CmdType;
/*
* JoinType -
* enums for types of relation joins
*
* JoinType determines the exact semantics of joining two relations using
* a matching qualification. For example, it tells what to do with a tuple
* that has no match in the other relation.
*
* This is needed in both parsenodes.h and plannodes.h, so put it here...
*/
typedef enum JoinType
{
/*
* The canonical kinds of joins according to the SQL JOIN syntax. Only
* these codes can appear in parser output (e.g., JoinExpr nodes).
*/
JOIN_INNER, /* matching tuple pairs only */
JOIN_LEFT, /* pairs + unmatched LHS tuples */
JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */
JOIN_RIGHT, /* pairs + unmatched RHS tuples */
/*
* Semijoins and anti-semijoins (as defined in relational theory) do not
* appear in the SQL JOIN syntax, but there are standard idioms for
* representing them (e.g., using EXISTS). The planner recognizes these
* cases and converts them to joins. So the planner and executor must
* support these codes. NOTE: in JOIN_SEMI output, it is unspecified
* which matching RHS row is joined to. In JOIN_ANTI output, the row is
* guaranteed to be null-extended.
*/
JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */
JOIN_ANTI, /* 1 copy of each LHS row that has no match */
/*
* These codes are used internally in the planner, but are not supported
* by the executor (nor, indeed, by most of the planner).
*/
JOIN_UNIQUE_OUTER, /* LHS path must be made unique */
JOIN_UNIQUE_INNER /* RHS path must be made unique */
/*
* We might need additional join types someday.
*/
} JoinType;
/*
* OUTER joins are those for which pushed-down quals must behave differently
* from the join's own quals. This is in fact everything except INNER and
* SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols
* since those are temporary proxies for what will eventually be an INNER
* join.
*
* Note: semijoins are a hybrid case, but we choose to treat them as not
* being outer joins. This is okay principally because the SQL syntax makes
* it impossible to have a pushed-down qual that refers to the inner relation
* of a semijoin; so there is no strong need to distinguish join quals from
* pushed-down quals. This is convenient because for almost all purposes,
* quals attached to a semijoin can be treated the same as innerjoin quals.
*/
#define IS_OUTER_JOIN(jointype) \
(((1 << (jointype)) & \
((1 << JOIN_LEFT) | \
(1 << JOIN_FULL) | \
(1 << JOIN_RIGHT) | \
(1 << JOIN_ANTI))) != 0)
/*
* AggStrategy -
* overall execution strategies for Agg plan nodes
*
* This is needed in both plannodes.h and relation.h, so put it here...
*/
typedef enum AggStrategy
{
AGG_PLAIN, /* simple agg across all input rows */
AGG_SORTED, /* grouped agg, input must be sorted */
AGG_HASHED /* grouped agg, use internal hashtable */
} AggStrategy;
/*
* AggSplit -
* splitting (partial aggregation) modes for Agg plan nodes
*
* This is needed in both plannodes.h and relation.h, so put it here...
*/
/* Primitive options supported by nodeAgg.c: */
#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */
#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */
#define AGGSPLITOP_SERIALIZE 0x04 /* apply serializefn to output */
#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserializefn to input */
/* Supported operating modes (i.e., useful combinations of these options): */
typedef enum AggSplit
{
/* Basic, non-split aggregation: */
AGGSPLIT_SIMPLE = 0,
/* Initial phase of partial aggregation, with serialization: */
AGGSPLIT_INITIAL_SERIAL = AGGSPLITOP_SKIPFINAL | AGGSPLITOP_SERIALIZE,
/* Final phase of partial aggregation, with deserialization: */
AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE | AGGSPLITOP_DESERIALIZE
} AggSplit;
/* Test whether an AggSplit value selects each primitive option: */
#define DO_AGGSPLIT_COMBINE(as) (((as) & AGGSPLITOP_COMBINE) != 0)
#define DO_AGGSPLIT_SKIPFINAL(as) (((as) & AGGSPLITOP_SKIPFINAL) != 0)
#define DO_AGGSPLIT_SERIALIZE(as) (((as) & AGGSPLITOP_SERIALIZE) != 0)
#define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0)
/*
* SetOpCmd and SetOpStrategy -
* overall semantics and execution strategies for SetOp plan nodes
*
* This is needed in both plannodes.h and relation.h, so put it here...
*/
typedef enum SetOpCmd
{
SETOPCMD_INTERSECT,
SETOPCMD_INTERSECT_ALL,
SETOPCMD_EXCEPT,
SETOPCMD_EXCEPT_ALL
} SetOpCmd;
typedef enum SetOpStrategy
{
SETOP_SORTED, /* input must be sorted */
SETOP_HASHED /* use internal hashtable */
} SetOpStrategy;
/*
* OnConflictAction -
* "ON CONFLICT" clause type of query
*
* This is needed in both parsenodes.h and plannodes.h, so put it here...
*/
typedef enum OnConflictAction
{
ONCONFLICT_NONE, /* No "ON CONFLICT" clause */
ONCONFLICT_NOTHING, /* ON CONFLICT ... DO NOTHING */
ONCONFLICT_UPDATE /* ON CONFLICT ... DO UPDATE */
} OnConflictAction;
#endif /* NODES_H */
# 781 "../../../../src/include/nodes/nodes.h"
# 41 "../../../../src/include/nodes/pg_list.h" 2
typedef struct ListCell ListCell;
typedef struct List
{
NodeTag type; /* T_List, T_IntList, or T_OidList */
int length;
ListCell *head;
ListCell *tail;
} List;
struct ListCell
{
union
{
void *ptr_value;
int int_value;
Oid oid_value;
} data;
ListCell *next;
};
/*
* The *only* valid representation of an empty list is NIL; in other
* words, a non-NIL list is guaranteed to have length >= 1 and
* head/tail != NULL
*/
#define NIL ((List *) NULL)
/*
* These routines are used frequently. However, we can't implement
* them as macros, since we want to avoid double-evaluation of macro
* arguments.
*/
static inline ListCell *
list_head(const List *l)
{
return l ? l->head : NULL;
}
static inline ListCell *
list_tail(List *l)
{
return l ? l->tail : NULL;
}
static inline int
list_length(const List *l)
{
return l ? l->length : 0;
}
/*
* NB: There is an unfortunate legacy from a previous incarnation of
* the List API: the macro lfirst() was used to mean "the data in this
* cons cell". To avoid changing every usage of lfirst(), that meaning
* has been kept. As a result, lfirst() takes a ListCell and returns
* the data it contains; to get the data in the first cell of a
* List, use linitial(). Worse, lsecond() is more closely related to
* linitial() than lfirst(): given a List, lsecond() returns the data
* in the second cons cell.
*/
#define lnext(lc) ((lc)->next)
#define lfirst(lc) ((lc)->data.ptr_value)
#define lfirst_int(lc) ((lc)->data.int_value)
#define lfirst_oid(lc) ((lc)->data.oid_value)
#define linitial(l) lfirst(list_head(l))
#define linitial_int(l) lfirst_int(list_head(l))
#define linitial_oid(l) lfirst_oid(list_head(l))
#define lsecond(l) lfirst(lnext(list_head(l)))
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
#define lthird(l) lfirst(lnext(lnext(list_head(l))))
#define lthird_int(l) lfirst_int(lnext(lnext(list_head(l))))
#define lthird_oid(l) lfirst_oid(lnext(lnext(list_head(l))))
#define lfourth(l) lfirst(lnext(lnext(lnext(list_head(l)))))
#define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
#define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l)))))
#define llast(l) lfirst(list_tail(l))
#define llast_int(l) lfirst_int(list_tail(l))
#define llast_oid(l) lfirst_oid(list_tail(l))
/*
* Convenience macros for building fixed-length lists
*/
#define list_make1(x1) lcons(x1, NIL)
#define list_make2(x1,x2) lcons(x1, list_make1(x2))
#define list_make3(x1,x2,x3) lcons(x1, list_make2(x2, x3))
#define list_make4(x1,x2,x3,x4) lcons(x1, list_make3(x2, x3, x4))
#define list_make5(x1,x2,x3,x4,x5) lcons(x1, list_make4(x2, x3, x4, x5))
#define list_make1_int(x1) lcons_int(x1, NIL)
#define list_make2_int(x1,x2) lcons_int(x1, list_make1_int(x2))
#define list_make3_int(x1,x2,x3) lcons_int(x1, list_make2_int(x2, x3))
#define list_make4_int(x1,x2,x3,x4) lcons_int(x1, list_make3_int(x2, x3, x4))
#define list_make5_int(x1,x2,x3,x4,x5) lcons_int(x1, list_make4_int(x2, x3, x4, x5))
#define list_make1_oid(x1) lcons_oid(x1, NIL)
#define list_make2_oid(x1,x2) lcons_oid(x1, list_make1_oid(x2))
#define list_make3_oid(x1,x2,x3) lcons_oid(x1, list_make2_oid(x2, x3))
#define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4))
#define list_make5_oid(x1,x2,x3,x4,x5) lcons_oid(x1, list_make4_oid(x2, x3, x4, x5))
/*
* foreach -
* a convenience macro which loops through the list
*/
#define foreach(cell, l) \
for ((cell) = list_head(l); (cell) != NULL; (cell) = lnext(cell))
/*
* for_each_cell -
* a convenience macro which loops through a list starting from a
* specified cell
*/
#define for_each_cell(cell, initcell) \
for ((cell) = (initcell); (cell) != NULL; (cell) = lnext(cell))
/*
* forboth -
* a convenience macro for advancing through two linked lists
* simultaneously. This macro loops through both lists at the same
* time, stopping when either list runs out of elements. Depending
* on the requirements of the call site, it may also be wise to
* assert that the lengths of the two lists are equal.
*/
#define forboth(cell1, list1, cell2, list2) \
for ((cell1) = list_head(list1), (cell2) = list_head(list2); \
(cell1) != NULL && (cell2) != NULL; \
(cell1) = lnext(cell1), (cell2) = lnext(cell2))
/*
* forthree -
* the same for three lists
*/
#define forthree(cell1, list1, cell2, list2, cell3, list3) \
for ((cell1) = list_head(list1), (cell2) = list_head(list2), (cell3) = list_head(list3); \
(cell1) != NULL && (cell2) != NULL && (cell3) != NULL; \
(cell1) = lnext(cell1), (cell2) = lnext(cell2), (cell3) = lnext(cell3))
extern List *lappend(List *list, void *datum);
extern List *lappend_int(List *list, int datum);
extern List *lappend_oid(List *list, Oid datum);
extern ListCell *lappend_cell(List *list, ListCell *prev, void *datum);
extern ListCell *lappend_cell_int(List *list, ListCell *prev, int datum);
extern ListCell *lappend_cell_oid(List *list, ListCell *prev, Oid datum);
extern List *lcons(void *datum, List *list);
extern List *lcons_int(int datum, List *list);
extern List *lcons_oid(Oid datum, List *list);
extern List *list_concat(List *list1, List *list2);
extern List *list_truncate(List *list, int new_size);
extern ListCell *list_nth_cell(const List *list, int n);
extern void *list_nth(const List *list, int n);
extern int list_nth_int(const List *list, int n);
extern Oid list_nth_oid(const List *list, int n);
extern bool list_member(const List *list, const void *datum);
extern bool list_member_ptr(const List *list, const void *datum);
extern bool list_member_int(const List *list, int datum);
extern bool list_member_oid(const List *list, Oid datum);
extern List *list_delete(List *list, void *datum);
extern List *list_delete_ptr(List *list, void *datum);
extern List *list_delete_int(List *list, int datum);
extern List *list_delete_oid(List *list, Oid datum);
extern List *list_delete_first(List *list);
extern List *list_delete_cell(List *list, ListCell *cell, ListCell *prev);
extern List *list_union(const List *list1, const List *list2);
extern List *list_union_ptr(const List *list1, const List *list2);
extern List *list_union_int(const List *list1, const List *list2);
extern List *list_union_oid(const List *list1, const List *list2);
extern List *list_intersection(const List *list1, const List *list2);
extern List *list_intersection_int(const List *list1, const List *list2);
/* currently, there's no need for list_intersection_ptr etc */
extern List *list_difference(const List *list1, const List *list2);
extern List *list_difference_ptr(const List *list1, const List *list2);
extern List *list_difference_int(const List *list1, const List *list2);
extern List *list_difference_oid(const List *list1, const List *list2);
extern List *list_append_unique(List *list, void *datum);
extern List *list_append_unique_ptr(List *list, void *datum);
extern List *list_append_unique_int(List *list, int datum);
extern List *list_append_unique_oid(List *list, Oid datum);
extern List *list_concat_unique(List *list1, List *list2);
extern List *list_concat_unique_ptr(List *list1, List *list2);
extern List *list_concat_unique_int(List *list1, List *list2);
extern List *list_concat_unique_oid(List *list1, List *list2);
extern void list_free(List *list);
extern void list_free_deep(List *list);
extern List *list_copy(const List *list);
extern List *list_copy_tail(const List *list, int nskip);
/*
* To ease migration to the new list API, a set of compatibility
* macros are provided that reduce the impact of the list API changes
* as far as possible. Until client code has been rewritten to use the
* new list API, the ENABLE_LIST_COMPAT symbol can be defined before
* including pg_list.h
*/
#ifdef ENABLE_LIST_COMPAT
#define lfirsti(lc) lfirst_int(lc)
#define lfirsto(lc) lfirst_oid(lc)
#define makeList1(x1) list_make1(x1)
#define makeList2(x1, x2) list_make2(x1, x2)
#define makeList3(x1, x2, x3) list_make3(x1, x2, x3)
#define makeList4(x1, x2, x3, x4) list_make4(x1, x2, x3, x4)
#define makeListi1(x1) list_make1_int(x1)
#define makeListi2(x1, x2) list_make2_int(x1, x2)
#define makeListo1(x1) list_make1_oid(x1)
#define makeListo2(x1, x2) list_make2_oid(x1, x2)
#define lconsi(datum, list) lcons_int(datum, list)
#define lconso(datum, list) lcons_oid(datum, list)
#define lappendi(list, datum) lappend_int(list, datum)
#define lappendo(list, datum) lappend_oid(list, datum)
#define nconc(l1, l2) list_concat(l1, l2)
#define nth(n, list) list_nth(list, n)
#define member(datum, list) list_member(list, datum)
#define ptrMember(datum, list) list_member_ptr(list, datum)
#define intMember(datum, list) list_member_int(list, datum)
#define oidMember(datum, list) list_member_oid(list, datum)
/*
* Note that the old lremove() determined equality via pointer
* comparison, whereas the new list_delete() uses equal(); in order to
* keep the same behavior, we therefore need to map lremove() calls to
* list_delete_ptr() rather than list_delete()
*/
#define lremove(elem, list) list_delete_ptr(list, elem)
#define LispRemove(elem, list) list_delete(list, elem)
#define lremovei(elem, list) list_delete_int(list, elem)
#define lremoveo(elem, list) list_delete_oid(list, elem)
#define ltruncate(n, list) list_truncate(list, n)
#define set_union(l1, l2) list_union(l1, l2)
#define set_uniono(l1, l2) list_union_oid(l1, l2)
#define set_ptrUnion(l1, l2) list_union_ptr(l1, l2)
#define set_difference(l1, l2) list_difference(l1, l2)
#define set_differenceo(l1, l2) list_difference_oid(l1, l2)
#define set_ptrDifference(l1, l2) list_difference_ptr(l1, l2)
#define equali(l1, l2) equal(l1, l2)
#define equalo(l1, l2) equal(l1, l2)
#define freeList(list) list_free(list)
#define listCopy(list) list_copy(list)
extern int length(List *list);
#endif /* ENABLE_LIST_COMPAT */
# 319 "../../../../src/include/nodes/pg_list.h"
#endif /* PG_LIST_H */
# 321 "../../../../src/include/nodes/pg_list.h"
# 20 "../../../../src/include/access/tupdesc.h" 2
typedef struct attrDefault
{
AttrNumber adnum;
char *adbin; /* nodeToString representation of expr */
} AttrDefault;
typedef struct constrCheck
{
char *ccname;
char *ccbin; /* nodeToString representation of expr */
bool ccvalid;
bool ccnoinherit; /* this is a non-inheritable constraint */
} ConstrCheck;
/* This structure contains constraints of a tuple */
typedef struct tupleConstr
{
AttrDefault *defval; /* array */
ConstrCheck *check; /* array */
uint16 num_defval;
uint16 num_check;
bool has_not_null;
} TupleConstr;
/*
* This struct is passed around within the backend to describe the structure
* of tuples. For tuples coming from on-disk relations, the information is
* collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs.
* Transient row types (such as the result of a join query) have anonymous
* TupleDesc structs that generally omit any constraint info; therefore the
* structure is designed to let the constraints be omitted efficiently.
*
* Note that only user attributes, not system attributes, are mentioned in
* TupleDesc; with the exception that tdhasoid indicates if OID is present.
*
* If the tupdesc is known to correspond to a named rowtype (such as a table's
* rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise
* tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous
* row type, or a value >= 0 to allow the rowtype to be looked up in the
* typcache.c type cache.
*
* Tuple descriptors that live in caches (relcache or typcache, at present)
* are reference-counted: they can be deleted when their reference count goes
* to zero. Tuple descriptors created by the executor need no reference
* counting, however: they are simply created in the appropriate memory
* context and go away when the context is freed. We set the tdrefcount
* field of such a descriptor to -1, while reference-counted descriptors
* always have tdrefcount >= 0.
*/
typedef struct tupleDesc
{
int natts; /* number of attributes in the tuple */
Form_pg_attribute *attrs;
/* attrs[N] is a pointer to the description of Attribute Number N+1 */
TupleConstr *constr; /* constraints, or NULL if none */
Oid tdtypeid; /* composite type ID for tuple type */
int32 tdtypmod; /* typmod for tuple type */
bool tdhasoid; /* tuple has oid attribute in its header */
int tdrefcount; /* reference count, or -1 if not counting */
} *TupleDesc;
extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
Form_pg_attribute *attrs);
extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
extern void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno,
TupleDesc src, AttrNumber srcAttno);
extern void FreeTupleDesc(TupleDesc tupdesc);
extern void IncrTupleDescRefCount(TupleDesc tupdesc);
extern void DecrTupleDescRefCount(TupleDesc tupdesc);
#define PinTupleDesc(tupdesc) \
do { \
if ((tupdesc)->tdrefcount >= 0) \
IncrTupleDescRefCount(tupdesc); \
} while (0)
#define ReleaseTupleDesc(tupdesc) \
do { \
if ((tupdesc)->tdrefcount >= 0) \
DecrTupleDescRefCount(tupdesc); \
} while (0)
extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
extern void TupleDescInitEntry(TupleDesc desc,
AttrNumber attributeNumber,
const char *attributeName,
Oid oidtypeid,
int32 typmod,
int attdim);
extern void TupleDescInitEntryCollation(TupleDesc desc,
AttrNumber attributeNumber,
Oid collationid);
extern TupleDesc BuildDescForRelation(List *schema);
extern TupleDesc BuildDescFromLists(List *names, List *types, List *typmods, List *collations);
#endif /* TUPDESC_H */
# 131 "../../../../src/include/access/tupdesc.h"
# 18 "../../../../src/include/utils/relcache.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "nodes/bitmapset.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/utils/relcache.h"
# 1 "../../../../src/include/nodes/bitmapset.h" 1
/*-------------------------------------------------------------------------
*
* bitmapset.h
* PostgreSQL generic bitmap set package
*
* A bitmap set can represent any set of nonnegative integers, although
* it is mainly intended for sets where the maximum value is not large,
* say at most a few hundred. By convention, a NULL pointer is always
* accepted by all operations to represent the empty set. (But beware
* that this is not the only representation of the empty set. Use
* bms_is_empty() in preference to testing for NULL.)
*
*
* Copyright (c) 2003-2016, PostgreSQL Global Development Group
*
* src/include/nodes/bitmapset.h
*
*-------------------------------------------------------------------------
*/
#ifndef BITMAPSET_H
#define BITMAPSET_H
/*
* Data representation
*/
/* The unit size can be adjusted by changing these three declarations: */
#define BITS_PER_BITMAPWORD 32
typedef uint32 bitmapword; /* must be an unsigned type */
typedef int32 signedbitmapword; /* must be the matching signed type */
typedef struct Bitmapset
{
int nwords; /* number of words in array */
bitmapword words[FLEXIBLE_ARRAY_MEMBER]; /* really [nwords] */
} Bitmapset;
/* result of bms_subset_compare */
typedef enum
{
BMS_EQUAL, /* sets are equal */
BMS_SUBSET1, /* first set is a subset of the second */
BMS_SUBSET2, /* second set is a subset of the first */
BMS_DIFFERENT /* neither set is a subset of the other */
} BMS_Comparison;
/* result of bms_membership */
typedef enum
{
BMS_EMPTY_SET, /* 0 members */
BMS_SINGLETON, /* 1 member */
BMS_MULTIPLE /* >1 member */
} BMS_Membership;
/*
* function prototypes in nodes/bitmapset.c
*/
extern Bitmapset *bms_copy(const Bitmapset *a);
extern bool bms_equal(const Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_make_singleton(int x);
extern void bms_free(Bitmapset *a);
extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b);
extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b);
extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b);
extern bool bms_is_member(int x, const Bitmapset *a);
extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b);
extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b);
extern int bms_singleton_member(const Bitmapset *a);
extern bool bms_get_singleton_member(const Bitmapset *a, int *member);
extern int bms_num_members(const Bitmapset *a);
/* optimized tests when we don't need to know exact membership count: */
extern BMS_Membership bms_membership(const Bitmapset *a);
extern bool bms_is_empty(const Bitmapset *a);
/* these routines recycle (modify or free) their non-const inputs: */
extern Bitmapset *bms_add_member(Bitmapset *a, int x);
extern Bitmapset *bms_del_member(Bitmapset *a, int x);
extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b);
extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b);
/* support for iterating through the integer elements of a set: */
extern int bms_first_member(Bitmapset *a);
extern int bms_next_member(const Bitmapset *a, int prevbit);
/* support for hashtables using Bitmapsets as keys: */
extern uint32 bms_hash_value(const Bitmapset *a);
#endif /* BITMAPSET_H */
# 99 "../../../../src/include/nodes/bitmapset.h"
# 19 "../../../../src/include/utils/relcache.h" 2
typedef struct RelationData *Relation;
/* ----------------
* RelationPtr is used in the executor to support index scans
* where we have to keep track of several index relations in an
* array. -cim 9/10/89
* ----------------
*/
typedef Relation *RelationPtr;
/*
* Routines to open (lookup) and close a relcache entry
*/
extern Relation RelationIdGetRelation(Oid relationId);
extern void RelationClose(Relation relation);
/*
* Routines to compute/retrieve additional cached information
*/
extern List *RelationGetFKeyList(Relation relation);
extern List *RelationGetIndexList(Relation relation);
extern Oid RelationGetOidIndex(Relation relation);
extern Oid RelationGetReplicaIndex(Relation relation);
extern List *RelationGetIndexExpressions(Relation relation);
extern List *RelationGetIndexPredicate(Relation relation);
typedef enum IndexAttrBitmapKind
{
INDEX_ATTR_BITMAP_ALL,
INDEX_ATTR_BITMAP_KEY,
INDEX_ATTR_BITMAP_IDENTITY_KEY
} IndexAttrBitmapKind;
extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation,
IndexAttrBitmapKind keyAttrs);
extern void RelationGetExclusionInfo(Relation indexRelation,
Oid **operators,
Oid **procs,
uint16 **strategies);
extern void RelationSetIndexList(Relation relation,
List *indexIds, Oid oidIndex);
extern void RelationInitIndexAccessInfo(Relation relation);
/*
* Routines to support ereport() reports of relation-related errors
*/
extern int errtable(Relation rel);
extern int errtablecol(Relation rel, int attnum);
extern int errtablecolname(Relation rel, const char *colname);
extern int errtableconstraint(Relation rel, const char *conname);
/*
* Routines for backend startup
*/
extern void RelationCacheInitialize(void);
extern void RelationCacheInitializePhase2(void);
extern void RelationCacheInitializePhase3(void);
/*
* Routine to create a relcache entry for an about-to-be-created relation
*/
extern Relation RelationBuildLocalRelation(const char *relname,
Oid relnamespace,
TupleDesc tupDesc,
Oid relid,
Oid relfilenode,
Oid reltablespace,
bool shared_relation,
bool mapped_relation,
char relpersistence,
char relkind);
/*
* Routine to manage assignment of new relfilenode to a relation
*/
extern void RelationSetNewRelfilenode(Relation relation, char persistence,
TransactionId freezeXid, MultiXactId minmulti);
/*
* Routines for flushing/rebuilding relcache entries in various scenarios
*/
extern void RelationForgetRelation(Oid rid);
extern void RelationCacheInvalidateEntry(Oid relationId);
extern void RelationCacheInvalidate(void);
extern void RelationCloseSmgrByOid(Oid relationId);
extern void AtEOXact_RelationCache(bool isCommit);
extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
SubTransactionId parentSubid);
/*
* Routines to help manage rebuilding of relcache init files
*/
extern bool RelationIdIsInInitFile(Oid relationId);
extern void RelationCacheInitFilePreInvalidate(void);
extern void RelationCacheInitFilePostInvalidate(void);
extern void RelationCacheInitFileRemove(void);
/* should be used only by relcache.c and catcache.c */
extern bool criticalRelcachesBuilt;
/* should be used only by relcache.c and postinit.c */
extern bool criticalSharedRelcachesBuilt;
#endif /* RELCACHE_H */
# 132 "../../../../src/include/utils/relcache.h"
# 22 "../../../../src/include/access/genam.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/snapshot.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/access/genam.h"
# 1 "../../../../src/include/utils/snapshot.h" 1
/*-------------------------------------------------------------------------
*
* snapshot.h
* POSTGRES snapshot definition
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/snapshot.h
*
*-------------------------------------------------------------------------
*/
#ifndef SNAPSHOT_H
#define SNAPSHOT_H
#if 0 /* expanded by -frewrite-includes */
#include "access/htup.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/utils/snapshot.h"
# 1 "../../../../src/include/access/htup.h" 1
/*-------------------------------------------------------------------------
*
* htup.h
* POSTGRES heap tuple definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/htup.h
*
*-------------------------------------------------------------------------
*/
#ifndef HTUP_H
#define HTUP_H
#if 0 /* expanded by -frewrite-includes */
#include "storage/itemptr.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/htup.h"
# 18 "../../../../src/include/access/htup.h"
/* typedefs and forward declarations for structs defined in htup_details.h */
typedef struct HeapTupleHeaderData HeapTupleHeaderData;
typedef HeapTupleHeaderData *HeapTupleHeader;
typedef struct MinimalTupleData MinimalTupleData;
typedef MinimalTupleData *MinimalTuple;
/*
* HeapTupleData is an in-memory data structure that points to a tuple.
*
* There are several ways in which this data structure is used:
*
* * Pointer to a tuple in a disk buffer: t_data points directly into the
* buffer (which the code had better be holding a pin on, but this is not
* reflected in HeapTupleData itself).
*
* * Pointer to nothing: t_data is NULL. This is used as a failure indication
* in some functions.
*
* * Part of a palloc'd tuple: the HeapTupleData itself and the tuple
* form a single palloc'd chunk. t_data points to the memory location
* immediately following the HeapTupleData struct (at offset HEAPTUPLESIZE).
* This is the output format of heap_form_tuple and related routines.
*
* * Separately allocated tuple: t_data points to a palloc'd chunk that
* is not adjacent to the HeapTupleData. (This case is deprecated since
* it's difficult to tell apart from case #1. It should be used only in
* limited contexts where the code knows that case #1 will never apply.)
*
* * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET
* bytes before the start of a MinimalTuple. As with the previous case,
* this can't be told apart from case #1 by inspection; code setting up
* or destroying this representation has to know what it's doing.
*
* t_len should always be valid, except in the pointer-to-nothing case.
* t_self and t_tableOid should be valid if the HeapTupleData points to
* a disk buffer, or if it represents a copy of a tuple on disk. They
* should be explicitly set invalid in manufactured tuples.
*/
typedef struct HeapTupleData
{
uint32 t_len; /* length of *t_data */
ItemPointerData t_self; /* SelfItemPointer */
Oid t_tableOid; /* table the tuple came from */
HeapTupleHeader t_data; /* -> tuple header and data */
} HeapTupleData;
typedef HeapTupleData *HeapTuple;
#define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData))
/*
* Accessor macros to be used with HeapTuple pointers.
*/
#define HeapTupleIsValid(tuple) PointerIsValid(tuple)
/* HeapTupleHeader functions implemented in utils/time/combocid.c */
extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup);
extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup);
extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup,
CommandId *cmax, bool *iscombo);
/* Prototype for HeapTupleHeader accessors in heapam.c */
extern TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple);
#endif /* HTUP_H */
# 89 "../../../../src/include/access/htup.h"
# 17 "../../../../src/include/utils/snapshot.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/utils/snapshot.h"
# 1 "../../../../src/include/access/xlogdefs.h" 1
/*
* xlogdefs.h
*
* Postgres transaction log manager record pointer and
* timeline number definitions
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/xlogdefs.h
*/
#ifndef XLOG_DEFS_H
#define XLOG_DEFS_H
#if 0 /* expanded by -frewrite-includes */
#include <fcntl.h> /* need open() flags */
#endif /* expanded by -frewrite-includes */
# 15 "../../../../src/include/access/xlogdefs.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 1 3 4
/*-
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fcntl.h 8.3 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
/*
* This file includes the definitions for open and fcntl
* described by POSIX for <fcntl.h>; it also includes
* related kernel definitions.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 47 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 49 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _MODE_T_DECLARED
typedef __mode_t mode_t;
#define _MODE_T_DECLARED
#endif
# 54 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _OFF_T_DECLARED
typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
#endif
# 64 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* File status flags: these are used by open(2), fcntl(2).
* They are also used (indirectly) in the kernel file structure f_flags,
* which is a superset of the open/fcntl flags. Open flags and f_flags
* are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
* Open/fcntl flags begin with O_; kernel-internal flags begin with F.
*/
/* open-only flags */
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
/*
* Kernel encoding of open mode; separate read and write bits that are
* independently testable: 1 greater than the above.
*
* XXX
* FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
* which was documented to use FREAD/FWRITE, continues to work.
*/
#if __BSD_VISIBLE
#define FREAD 0x0001
#define FWRITE 0x0002
#endif
# 90 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_NONBLOCK 0x0004 /* no delay */
#define O_APPEND 0x0008 /* set append mode */
#if __BSD_VISIBLE
#define O_SHLOCK 0x0010 /* open with shared file lock */
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
#define O_FSYNC 0x0080 /* synchronous writes */
#endif
# 98 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */
#if __POSIX_VISIBLE >= 200809
#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
#endif
# 102 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_CREAT 0x0200 /* create if nonexistent */
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
#ifdef _KERNEL
#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
#endif
# 108 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
#define O_NOCTTY 0x8000 /* don't assign controlling terminal */
#if __BSD_VISIBLE
/* Attempt to bypass buffer cache */
#define O_DIRECT 0x00010000
#endif
# 116 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
#define O_DIRECTORY 0x00020000 /* Fail if not directory */
#define O_EXEC 0x00040000 /* Open for execute only */
#endif
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifdef _KERNEL
#define FEXEC O_EXEC
#endif
# 124 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */
#define O_CLOEXEC 0x00100000
#endif
# 131 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define O_VERIFY 0x00200000 /* open only after verification */
#endif
# 135 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* XXX missing O_DSYNC, O_RSYNC.
*/
#ifdef _KERNEL
/* Only for devfs d_close() flags. */
#define FLASTCLOSE O_DIRECTORY
#define FREVOKE O_VERIFY
/* Only for fo_close() from half-succeeded open */
#define FOPENFAILED O_TTY_INIT
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
#define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
#define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1)
/* bits to save after open */
#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
/* bits settable by fcntl(F_SETFL, ...) */
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)
#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \
defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)
/*
* Set by shm_open(3) in older libc's to get automatic MAP_ASYNC
* behavior for POSIX shared memory objects (which are otherwise
* implemented as plain files).
*/
#define FPOSIXSHM O_NOFOLLOW
#undef FCNTLFLAGS
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \
O_DIRECT)
#endif
# 169 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#endif
# 170 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* The O_* flags used to have only F* names, which were used in the kernel
* and by fcntl. We retain the F* names for the kernel f_flag field
* and for backward compatibility for fcntl. These flags are deprecated.
*/
#if __BSD_VISIBLE
#define FAPPEND O_APPEND /* kernel/compat */
#define FASYNC O_ASYNC /* kernel/compat */
#define FFSYNC O_FSYNC /* kernel */
#define FNONBLOCK O_NONBLOCK /* kernel */
#define FNDELAY O_NONBLOCK /* compat */
#define O_NDELAY O_NONBLOCK /* compat */
#endif
# 184 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* We are out of bits in f_flag (which is a short). However,
* the flag bits not set in FMASK are only meaningful in the
* initial open syscall. Those bits can thus be given a
* different meaning for fcntl(2).
*/
#if __BSD_VISIBLE
/* Read ahead */
#define FRDAHEAD O_CREAT
#endif
# 195 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
/*
* Magic value that specify the use of the current working directory
* to determine the target of relative file paths in the openat() and
* similar syscalls.
*/
#define AT_FDCWD -100
/*
* Miscellaneous flags for the *at() syscalls.
*/
#define AT_EACCESS 0x100 /* Check access using effective user and group ID */
#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */
#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */
#endif
# 212 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* Constants used for fcntl(2)
*/
/* command values */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
# 227 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define F_OGETLK 7 /* get record locking information */
#define F_OSETLK 8 /* set record locking information */
#define F_OSETLKW 9 /* F_SETLK; wait if blocked */
#define F_DUP2FD 10 /* duplicate file descriptor to arg */
#endif
# 233 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define F_GETLK 11 /* get record locking information */
#define F_SETLK 12 /* set record locking information */
#define F_SETLKW 13 /* F_SETLK; wait if blocked */
#if __BSD_VISIBLE
#define F_SETLK_REMOTE 14 /* debugging support for remote locks */
#define F_READAHEAD 15 /* read ahead */
#define F_RDAHEAD 16 /* Darwin compatible read ahead */
#endif
# 241 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
#endif
# 244 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */
#endif
# 247 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/* file descriptor flags (F_GETFD, F_SETFD) */
#define FD_CLOEXEC 1 /* close-on-exec flag */
/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
#define F_RDLCK 1 /* shared or read lock */
#define F_UNLCK 2 /* unlock */
#define F_WRLCK 3 /* exclusive or write lock */
#if __BSD_VISIBLE
#define F_UNLCKSYS 4 /* purge locks for a given system ID */
#define F_CANCEL 5 /* cancel an async lock request */
#endif
# 259 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifdef _KERNEL
#define F_WAIT 0x010 /* Wait until lock is granted */
#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */
#define F_POSIX 0x040 /* Use POSIX semantics for lock */
#define F_REMOTE 0x080 /* Lock owner is remote NFS client */
#define F_NOINTR 0x100 /* Ignore signals when waiting */
#endif
# 266 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* Advisory file segment locking data type -
* information passed to system by user
*/
struct flock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
int l_sysid; /* remote system id or zero for local */
};
#if __BSD_VISIBLE
/*
* Old advisory file segment locking data type,
* before adding l_sysid.
*/
struct __oflock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
};
#endif
# 293 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
/* lock operations for flock(2) */
#define LOCK_SH 0x01 /* shared file lock */
#define LOCK_EX 0x02 /* exclusive file lock */
#define LOCK_NB 0x04 /* don't block when locking */
#define LOCK_UN 0x08 /* unlock file */
#endif
# 301 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200112
/*
* Advice to posix_fadvise
*/
#define POSIX_FADV_NORMAL 0 /* no special treatment */
#define POSIX_FADV_RANDOM 1 /* expect random page references */
#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */
#define POSIX_FADV_WILLNEED 3 /* will need these pages */
#define POSIX_FADV_DONTNEED 4 /* dont need these pages */
#define POSIX_FADV_NOREUSE 5 /* access data only once */
#endif
# 313 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _KERNEL
__BEGIN_DECLS
int open(const char *, int, ...);
int creat(const char *, mode_t);
int fcntl(int, int, ...);
#if __BSD_VISIBLE
int flock(int, int);
#endif
# 322 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
int openat(int, const char *, int, ...);
#endif
# 325 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200112
int posix_fadvise(int, off_t, off_t, int);
int posix_fallocate(int, off_t, off_t);
#endif
# 329 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
__END_DECLS
#endif
# 331 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
#endif /* !_SYS_FCNTL_H_ */
# 333 "/home/en322/cheri/output/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 16 "../../../../src/include/access/xlogdefs.h" 2
/*
* Pointer to a location in the XLOG. These pointers are 64 bits wide,
* because we don't want them ever to overflow.
*/
typedef uint64 XLogRecPtr;
/*
* Zero is used indicate an invalid pointer. Bootstrap skips the first possible
* WAL segment, initializing the first WAL page at XLOG_SEG_SIZE, so no XLOG
* record can begin at zero.
*/
#define InvalidXLogRecPtr 0
#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr)
/*
* XLogSegNo - physical log file sequence number.
*/
typedef uint64 XLogSegNo;
/*
* TimeLineID (TLI) - identifies different database histories to prevent
* confusion after restoring a prior state of a database installation.
* TLI does not change in a normal stop/restart of the database (including
* crash-and-recover cases); but we must assign a new TLI after doing
* a recovery to a prior state, a/k/a point-in-time recovery. This makes
* the new WAL logfile sequence we generate distinguishable from the
* sequence that was generated in the previous incarnation.
*/
typedef uint32 TimeLineID;
/*
* Replication origin id - this is located in this file to avoid having to
* include origin.h in a bunch of xlog related places.
*/
typedef uint16 RepOriginId;
/*
* Because O_DIRECT bypasses the kernel buffers, and because we never
* read those buffers except during crash recovery or if wal_level != minimal,
* it is a win to use it in all cases where we sync on each write(). We could
* allow O_DIRECT with fsync(), but it is unclear if fsync() could process
* writes not buffered in the kernel. Also, O_DIRECT is never enough to force
* data to the drives, it merely tries to bypass the kernel cache, so we still
* need O_SYNC/O_DSYNC.
*/
#ifdef O_DIRECT
#define PG_O_DIRECT O_DIRECT
#else
# 65 "../../../../src/include/access/xlogdefs.h"
#define PG_O_DIRECT 0
#endif
# 67 "../../../../src/include/access/xlogdefs.h"
/*
* This chunk of hackery attempts to determine which file sync methods
* are available on the current platform, and to choose an appropriate
* default method. We assume that fsync() is always available, and that
* configure determined whether fdatasync() is.
*/
#if defined(O_SYNC)
#define OPEN_SYNC_FLAG O_SYNC
#elif defined(O_FSYNC)
# 77 "../../../../src/include/access/xlogdefs.h"
#define OPEN_SYNC_FLAG O_FSYNC
#endif
# 79 "../../../../src/include/access/xlogdefs.h"
#if defined(O_DSYNC)
#if defined(OPEN_SYNC_FLAG)
/* O_DSYNC is distinct? */
#if O_DSYNC != OPEN_SYNC_FLAG
#define OPEN_DATASYNC_FLAG O_DSYNC
#endif
# 86 "../../../../src/include/access/xlogdefs.h"
#else /* !defined(OPEN_SYNC_FLAG) */
# 87 "../../../../src/include/access/xlogdefs.h"
/* Win32 only has O_DSYNC */
#define OPEN_DATASYNC_FLAG O_DSYNC
#endif
# 90 "../../../../src/include/access/xlogdefs.h"
#endif
# 91 "../../../../src/include/access/xlogdefs.h"
#if defined(PLATFORM_DEFAULT_SYNC_METHOD)
#define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD
#elif defined(OPEN_DATASYNC_FLAG)
# 95 "../../../../src/include/access/xlogdefs.h"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC
#elif defined(HAVE_FDATASYNC)
# 97 "../../../../src/include/access/xlogdefs.h"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
#else
# 99 "../../../../src/include/access/xlogdefs.h"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
#endif
# 101 "../../../../src/include/access/xlogdefs.h"
#endif /* XLOG_DEFS_H */
# 103 "../../../../src/include/access/xlogdefs.h"
# 18 "../../../../src/include/utils/snapshot.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "lib/pairingheap.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/utils/snapshot.h"
# 1 "../../../../src/include/lib/pairingheap.h" 1
/*
* pairingheap.h
*
* A Pairing Heap implementation
*
* Portions Copyright (c) 2012-2016, PostgreSQL Global Development Group
*
* src/include/lib/pairingheap.h
*/
#ifndef PAIRINGHEAP_H
#define PAIRINGHEAP_H
#if 0 /* expanded by -frewrite-includes */
#include "lib/stringinfo.h"
#endif /* expanded by -frewrite-includes */
# 14 "../../../../src/include/lib/pairingheap.h"
# 1 "../../../../src/include/lib/stringinfo.h" 1
/*-------------------------------------------------------------------------
*
* stringinfo.h
* Declarations/definitions for "StringInfo" functions.
*
* StringInfo provides an indefinitely-extensible string data type.
* It can be used to buffer either ordinary C strings (null-terminated text)
* or arbitrary binary data. All storage is allocated with palloc().
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/lib/stringinfo.h
*
*-------------------------------------------------------------------------
*/
#ifndef STRINGINFO_H
#define STRINGINFO_H
/*-------------------------
* StringInfoData holds information about an extensible string.
* data is the current buffer for the string (allocated with palloc).
* len is the current string length. There is guaranteed to be
* a terminating '\0' at data[len], although this is not very
* useful when the string holds binary data rather than text.
* maxlen is the allocated size in bytes of 'data', i.e. the maximum
* string size (including the terminating '\0' char) that we can
* currently store in 'data' without having to reallocate
* more space. We must always have maxlen > len.
* cursor is initialized to zero by makeStringInfo or initStringInfo,
* but is not otherwise touched by the stringinfo.c routines.
* Some routines use it to scan through a StringInfo.
*-------------------------
*/
typedef struct StringInfoData
{
char *data;
int len;
int maxlen;
int cursor;
} StringInfoData;
typedef StringInfoData *StringInfo;
/*------------------------
* There are two ways to create a StringInfo object initially:
*
* StringInfo stringptr = makeStringInfo();
* Both the StringInfoData and the data buffer are palloc'd.
*
* StringInfoData string;
* initStringInfo(&string);
* The data buffer is palloc'd but the StringInfoData is just local.
* This is the easiest approach for a StringInfo object that will
* only live as long as the current routine.
*
* To destroy a StringInfo, pfree() the data buffer, and then pfree() the
* StringInfoData if it was palloc'd. There's no special support for this.
*
* NOTE: some routines build up a string using StringInfo, and then
* release the StringInfoData but return the data string itself to their
* caller. At that point the data string looks like a plain palloc'd
* string.
*-------------------------
*/
/*------------------------
* makeStringInfo
* Create an empty 'StringInfoData' & return a pointer to it.
*/
extern StringInfo makeStringInfo(void);
/*------------------------
* initStringInfo
* Initialize a StringInfoData struct (with previously undefined contents)
* to describe an empty string.
*/
extern void initStringInfo(StringInfo str);
/*------------------------
* resetStringInfo
* Clears the current content of the StringInfo, if any. The
* StringInfo remains valid.
*/
extern void resetStringInfo(StringInfo str);
/*------------------------
* appendStringInfo
* Format text data under the control of fmt (an sprintf-style format string)
* and append it to whatever is already in str. More space is allocated
* to str if necessary. This is sort of like a combination of sprintf and
* strcat.
*/
extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3);
/*------------------------
* appendStringInfoVA
* Attempt to format text data under the control of fmt (an sprintf-style
* format string) and append it to whatever is already in str. If successful
* return zero; if not (because there's not enough space), return an estimate
* of the space needed, without modifying str. Typically the caller should
* pass the return value to enlargeStringInfo() before trying again; see
* appendStringInfo for standard usage pattern.
*/
extern int appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0);
/*------------------------
* appendStringInfoString
* Append a null-terminated string to str.
* Like appendStringInfo(str, "%s", s) but faster.
*/
extern void appendStringInfoString(StringInfo str, const char *s);
/*------------------------
* appendStringInfoChar
* Append a single byte to str.
* Like appendStringInfo(str, "%c", ch) but much faster.
*/
extern void appendStringInfoChar(StringInfo str, char ch);
/*------------------------
* appendStringInfoCharMacro
* As above, but a macro for even more speed where it matters.
* Caution: str argument will be evaluated multiple times.
*/
#define appendStringInfoCharMacro(str,ch) \
(((str)->len + 1 >= (str)->maxlen) ? \
appendStringInfoChar(str, ch) : \
(void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
/*------------------------
* appendStringInfoSpaces
* Append a given number of spaces to str.
*/
extern void appendStringInfoSpaces(StringInfo str, int count);
/*------------------------
* appendBinaryStringInfo
* Append arbitrary binary data to a StringInfo, allocating more space
* if necessary.
*/
extern void appendBinaryStringInfo(StringInfo str,
const char *data, int datalen);
/*------------------------
* enlargeStringInfo
* Make sure a StringInfo's buffer can hold at least 'needed' more bytes.
*/
extern void enlargeStringInfo(StringInfo str, int needed);
#endif /* STRINGINFO_H */
# 153 "../../../../src/include/lib/stringinfo.h"
# 15 "../../../../src/include/lib/pairingheap.h" 2
/* Enable if you need the pairingheap_dump() debug function */
/* #define PAIRINGHEAP_DEBUG */
/*
* This represents an element stored in the heap. Embed this in a larger
* struct containing the actual data you're storing.
*
* A node can have multiple children, which form a double-linked list.
* first_child points to the node's first child, and the subsequent children
* can be found by following the next_sibling pointers. The last child has
* next_sibling == NULL. The prev_or_parent pointer points to the node's
* previous sibling, or if the node is its parent's first child, to the
* parent.
*/
typedef struct pairingheap_node
{
struct pairingheap_node *first_child;
struct pairingheap_node *next_sibling;
struct pairingheap_node *prev_or_parent;
} pairingheap_node;
/*
* Return the containing struct of 'type' where 'membername' is the
* pairingheap_node pointed at by 'ptr'.
*
* This is used to convert a pairingheap_node * back to its containing struct.
*/
#define pairingheap_container(type, membername, ptr) \
(AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \
AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \
((type *) ((char *) (ptr) - offsetof(type, membername))))
/*
* Like pairingheap_container, but used when the pointer is 'const ptr'
*/
#define pairingheap_const_container(type, membername, ptr) \
(AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \
AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \
((const type *) ((const char *) (ptr) - offsetof(type, membername))))
/*
* For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b,
* and >0 iff a > b. For a min-heap, the conditions are reversed.
*/
typedef int (*pairingheap_comparator) (const pairingheap_node *a,
const pairingheap_node *b,
void *arg);
/*
* A pairing heap.
*
* You can use pairingheap_allocate() to create a new palloc'd heap, or embed
* this in a larger struct, set ph_compare and ph_arg directly and initialize
* ph_root to NULL.
*/
typedef struct pairingheap
{
pairingheap_comparator ph_compare; /* comparison function */
void *ph_arg; /* opaque argument to ph_compare */
pairingheap_node *ph_root; /* current root of the heap */
} pairingheap;
extern pairingheap *pairingheap_allocate(pairingheap_comparator compare,
void *arg);
extern void pairingheap_free(pairingheap *heap);
extern void pairingheap_add(pairingheap *heap, pairingheap_node *node);
extern pairingheap_node *pairingheap_first(pairingheap *heap);
extern pairingheap_node *pairingheap_remove_first(pairingheap *heap);
extern void pairingheap_remove(pairingheap *heap, pairingheap_node *node);
#ifdef PAIRINGHEAP_DEBUG
extern char *pairingheap_dump(pairingheap *heap,
void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque),
void *opaque);
#endif
# 91 "../../../../src/include/lib/pairingheap.h"
/* Resets the heap to be empty. */
#define pairingheap_reset(h) ((h)->ph_root = NULL)
/* Is the heap empty? */
#define pairingheap_is_empty(h) ((h)->ph_root == NULL)
/* Is there exactly one node in the heap? */
#define pairingheap_is_singular(h) \
((h)->ph_root && (h)->ph_root->first_child == NULL)
#endif /* PAIRINGHEAP_H */
# 103 "../../../../src/include/lib/pairingheap.h"
# 19 "../../../../src/include/utils/snapshot.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/buf.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/utils/snapshot.h"
# 1 "../../../../src/include/storage/buf.h" 1
/*-------------------------------------------------------------------------
*
* buf.h
* Basic buffer manager data types.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/buf.h
*
*-------------------------------------------------------------------------
*/
#ifndef BUF_H
#define BUF_H
/*
* Buffer identifiers.
*
* Zero is invalid, positive is the index of a shared buffer (1..NBuffers),
* negative is the index of a local buffer (-1 .. -NLocBuffer).
*/
typedef int Buffer;
#define InvalidBuffer 0
/*
* BufferIsInvalid
* True iff the buffer is invalid.
*/
#define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer)
/*
* BufferIsLocal
* True iff the buffer is local (not visible to other backends).
*/
#define BufferIsLocal(buffer) ((buffer) < 0)
/*
* Buffer access strategy objects.
*
* BufferAccessStrategyData is private to freelist.c
*/
typedef struct BufferAccessStrategyData *BufferAccessStrategy;
#endif /* BUF_H */
# 47 "../../../../src/include/storage/buf.h"
# 20 "../../../../src/include/utils/snapshot.h" 2
typedef struct SnapshotData *Snapshot;
#define InvalidSnapshot ((Snapshot) NULL)
/*
* We use SnapshotData structures to represent both "regular" (MVCC)
* snapshots and "special" snapshots that have non-MVCC semantics.
* The specific semantics of a snapshot are encoded by the "satisfies"
* function.
*/
typedef bool (*SnapshotSatisfiesFunc) (HeapTuple htup,
Snapshot snapshot, Buffer buffer);
/*
* Struct representing all kind of possible snapshots.
*
* There are several different kinds of snapshots:
* * Normal MVCC snapshots
* * MVCC snapshots taken during recovery (in Hot-Standby mode)
* * Historic MVCC snapshots used during logical decoding
* * snapshots passed to HeapTupleSatisfiesDirty()
* * snapshots used for SatisfiesAny, Toast, Self where no members are
* accessed.
*
* TODO: It's probably a good idea to split this struct using a NodeTag
* similar to how parser and executor nodes are handled, with one type for
* each different kind of snapshot to avoid overloading the meaning of
* individual fields.
*/
typedef struct SnapshotData
{
SnapshotSatisfiesFunc satisfies; /* tuple test function */
/*
* The remaining fields are used only for MVCC snapshots, and are normally
* just zeroes in special snapshots. (But xmin and xmax are used
* specially by HeapTupleSatisfiesDirty.)
*
* An MVCC snapshot can never see the effects of XIDs >= xmax. It can see
* the effects of all older XIDs except those listed in the snapshot. xmin
* is stored as an optimization to avoid needing to search the XID arrays
* for most tuples.
*/
TransactionId xmin; /* all XID < xmin are visible to me */
TransactionId xmax; /* all XID >= xmax are invisible to me */
/*
* For normal MVCC snapshot this contains the all xact IDs that are in
* progress, unless the snapshot was taken during recovery in which case
* it's empty. For historic MVCC snapshots, the meaning is inverted, i.e.
* it contains *committed* transactions between xmin and xmax.
*
* note: all ids in xip[] satisfy xmin <= xip[i] < xmax
*/
TransactionId *xip;
uint32 xcnt; /* # of xact ids in xip[] */
/*
* For non-historic MVCC snapshots, this contains subxact IDs that are in
* progress (and other transactions that are in progress if taken during
* recovery). For historic snapshot it contains *all* xids assigned to the
* replayed transaction, including the toplevel xid.
*
* note: all ids in subxip[] are >= xmin, but we don't bother filtering
* out any that are >= xmax
*/
TransactionId *subxip;
int32 subxcnt; /* # of xact ids in subxip[] */
bool suboverflowed; /* has the subxip array overflowed? */
bool takenDuringRecovery; /* recovery-shaped snapshot? */
bool copied; /* false if it's a static snapshot */
CommandId curcid; /* in my xact, CID < curcid are visible */
/*
* An extra return value for HeapTupleSatisfiesDirty, not used in MVCC
* snapshots.
*/
uint32 speculativeToken;
/*
* Book-keeping information, used by the snapshot manager
*/
uint32 active_count; /* refcount on ActiveSnapshot stack */
uint32 regd_count; /* refcount on RegisteredSnapshots */
pairingheap_node ph_node; /* link in the RegisteredSnapshots heap */
int64 whenTaken; /* timestamp when snapshot was taken */
XLogRecPtr lsn; /* position in the WAL stream when taken */
} SnapshotData;
/*
* Result codes for HeapTupleSatisfiesUpdate. This should really be in
* tqual.h, but we want to avoid including that file elsewhere.
*/
typedef enum
{
HeapTupleMayBeUpdated,
HeapTupleInvisible,
HeapTupleSelfUpdated,
HeapTupleUpdated,
HeapTupleBeingUpdated,
HeapTupleWouldBlock /* can be returned by heap_tuple_lock */
} HTSU_Result;
#endif /* SNAPSHOT_H */
# 129 "../../../../src/include/utils/snapshot.h"
# 23 "../../../../src/include/access/genam.h" 2
/*
* Struct for statistics returned by ambuild
*/
typedef struct IndexBuildResult
{
double heap_tuples; /* # of tuples seen in parent table */
double index_tuples; /* # of tuples inserted into index */
} IndexBuildResult;
/*
* Struct for input arguments passed to ambulkdelete and amvacuumcleanup
*
* num_heap_tuples is accurate only when estimated_count is false;
* otherwise it's just an estimate (currently, the estimate is the
* prior value of the relation's pg_class.reltuples field). It will
* always just be an estimate during ambulkdelete.
*/
typedef struct IndexVacuumInfo
{
Relation index; /* the index being vacuumed */
bool analyze_only; /* ANALYZE (without any actual vacuum) */
bool estimated_count; /* num_heap_tuples is an estimate */
int message_level; /* ereport level for progress messages */
double num_heap_tuples; /* tuples remaining in heap */
BufferAccessStrategy strategy; /* access strategy for reads */
} IndexVacuumInfo;
/*
* Struct for statistics returned by ambulkdelete and amvacuumcleanup
*
* This struct is normally allocated by the first ambulkdelete call and then
* passed along through subsequent ones until amvacuumcleanup; however,
* amvacuumcleanup must be prepared to allocate it in the case where no
* ambulkdelete calls were made (because no tuples needed deletion).
* Note that an index AM could choose to return a larger struct
* of which this is just the first field; this provides a way for ambulkdelete
* to communicate additional private data to amvacuumcleanup.
*
* Note: pages_removed is the amount by which the index physically shrank,
* if any (ie the change in its total size on disk). pages_deleted and
* pages_free refer to free space within the index file. Some index AMs
* may compute num_index_tuples by reference to num_heap_tuples, in which
* case they should copy the estimated_count field from IndexVacuumInfo.
*/
typedef struct IndexBulkDeleteResult
{
BlockNumber num_pages; /* pages remaining in index */
BlockNumber pages_removed; /* # removed during vacuum operation */
bool estimated_count; /* num_index_tuples is an estimate */
double num_index_tuples; /* tuples remaining */
double tuples_removed; /* # removed during vacuum operation */
BlockNumber pages_deleted; /* # unused pages in index */
BlockNumber pages_free; /* # pages available for reuse */
} IndexBulkDeleteResult;
/* Typedef for callback function to determine if a tuple is bulk-deletable */
typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state);
/* struct definitions appear in relscan.h */
typedef struct IndexScanDescData *IndexScanDesc;
typedef struct SysScanDescData *SysScanDesc;
/*
* Enumeration specifying the type of uniqueness check to perform in
* index_insert().
*
* UNIQUE_CHECK_YES is the traditional Postgres immediate check, possibly
* blocking to see if a conflicting transaction commits.
*
* For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at
* insertion time. The index AM should test if the tuple is unique, but
* should not throw error, block, or prevent the insertion if the tuple
* appears not to be unique. We'll recheck later when it is time for the
* constraint to be enforced. The AM must return true if the tuple is
* known unique, false if it is possibly non-unique. In the "true" case
* it is safe to omit the later recheck.
*
* When it is time to recheck the deferred constraint, a pseudo-insertion
* call is made with UNIQUE_CHECK_EXISTING. The tuple is already in the
* index in this case, so it should not be inserted again. Rather, just
* check for conflicting live tuples (possibly blocking).
*/
typedef enum IndexUniqueCheck
{
UNIQUE_CHECK_NO, /* Don't do any uniqueness checking */
UNIQUE_CHECK_YES, /* Enforce uniqueness at insertion time */
UNIQUE_CHECK_PARTIAL, /* Test uniqueness, but no error */
UNIQUE_CHECK_EXISTING /* Check if existing tuple is unique */
} IndexUniqueCheck;
/*
* generalized index_ interface routines (in indexam.c)
*/
/*
* IndexScanIsValid
* True iff the index scan is valid.
*/
#define IndexScanIsValid(scan) PointerIsValid(scan)
extern Relation index_open(Oid relationId, LOCKMODE lockmode);
extern void index_close(Relation relation, LOCKMODE lockmode);
extern bool index_insert(Relation indexRelation,
Datum *values, bool *isnull,
ItemPointer heap_t_ctid,
Relation heapRelation,
IndexUniqueCheck checkUnique);
extern IndexScanDesc index_beginscan(Relation heapRelation,
Relation indexRelation,
Snapshot snapshot,
int nkeys, int norderbys);
extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation,
Snapshot snapshot,
int nkeys);
extern void index_rescan(IndexScanDesc scan,
ScanKey keys, int nkeys,
ScanKey orderbys, int norderbys);
extern void index_endscan(IndexScanDesc scan);
extern void index_markpos(IndexScanDesc scan);
extern void index_restrpos(IndexScanDesc scan);
extern ItemPointer index_getnext_tid(IndexScanDesc scan,
ScanDirection direction);
extern HeapTuple index_fetch_heap(IndexScanDesc scan);
extern HeapTuple index_getnext(IndexScanDesc scan, ScanDirection direction);
extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap);
extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info,
IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback,
void *callback_state);
extern IndexBulkDeleteResult *index_vacuum_cleanup(IndexVacuumInfo *info,
IndexBulkDeleteResult *stats);
extern bool index_can_return(Relation indexRelation, int attno);
extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
extern FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
uint16 procnum);
/*
* index access method support routines (in genam.c)
*/
extern IndexScanDesc RelationGetIndexScan(Relation indexRelation,
int nkeys, int norderbys);
extern void IndexScanEnd(IndexScanDesc scan);
extern char *BuildIndexValueDescription(Relation indexRelation,
Datum *values, bool *isnull);
/*
* heap-or-index access to system catalogs (in genam.c)
*/
extern SysScanDesc systable_beginscan(Relation heapRelation,
Oid indexId,
bool indexOK,
Snapshot snapshot,
int nkeys, ScanKey key);
extern HeapTuple systable_getnext(SysScanDesc sysscan);
extern bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup);
extern void systable_endscan(SysScanDesc sysscan);
extern SysScanDesc systable_beginscan_ordered(Relation heapRelation,
Relation indexRelation,
Snapshot snapshot,
int nkeys, ScanKey key);
extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan,
ScanDirection direction);
extern void systable_endscan_ordered(SysScanDesc sysscan);
#endif /* GENAM_H */
# 194 "../../../../src/include/access/genam.h"
# 19 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/spgist_private.h"
#endif /* expanded by -frewrite-includes */
# 19 "spgdoinsert.c"
# 1 "../../../../src/include/access/spgist_private.h" 1
/*-------------------------------------------------------------------------
*
* spgist_private.h
* Private declarations for SP-GiST access method.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/spgist_private.h
*
*-------------------------------------------------------------------------
*/
#ifndef SPGIST_PRIVATE_H
#define SPGIST_PRIVATE_H
#if 0 /* expanded by -frewrite-includes */
#include "access/itup.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/spgist_private.h"
# 1 "../../../../src/include/access/itup.h" 1
/*-------------------------------------------------------------------------
*
* itup.h
* POSTGRES index tuple definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/itup.h
*
*-------------------------------------------------------------------------
*/
#ifndef ITUP_H
#define ITUP_H
#if 0 /* expanded by -frewrite-includes */
#include "access/tupdesc.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/itup.h"
# 18 "../../../../src/include/access/itup.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/tupmacs.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/itup.h"
# 1 "../../../../src/include/access/tupmacs.h" 1
/*-------------------------------------------------------------------------
*
* tupmacs.h
* Tuple macros used by both index tuples and heap tuples.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/tupmacs.h
*
*-------------------------------------------------------------------------
*/
#ifndef TUPMACS_H
#define TUPMACS_H
/*
* check to see if the ATT'th bit of an array of 8-bit bytes is set.
*/
#define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) & 0x07))))
/*
* Given a Form_pg_attribute and a pointer into a tuple's data area,
* return the correct value or pointer.
*
* We return a Datum value in all cases. If the attribute has "byval" false,
* we return the same pointer into the tuple data area that we're passed.
* Otherwise, we return the correct number of bytes fetched from the data
* area and extended to Datum form.
*
* On machines where Datum is 8 bytes, we support fetching 8-byte byval
* attributes; otherwise, only 1, 2, and 4-byte values are supported.
*
* Note that T must already be properly aligned for this to work correctly.
*/
#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen)
/*
* Same, but work from byval/len parameters rather than Form_pg_attribute.
*/
#if SIZEOF_DATUM >= 8
#define fetch_att(T,attbyval,attlen) \
( \
(attbyval) ? \
( \
(attlen) == (int) sizeof(Datum) ? \
*((Datum *)(T)) \
: \
( \
(attlen) == (int) sizeof(int32) ? \
Int32GetDatum(*((int32 *)(T))) \
: \
( \
(attlen) == (int) sizeof(int16) ? \
Int16GetDatum(*((int16 *)(T))) \
: \
( \
AssertMacro((attlen) == 1), \
CharGetDatum(*((char *)(T))) \
) \
) \
) \
) \
: \
PointerGetDatum((char *) (T)) \
)
#else /* SIZEOF_DATUM != 8 */
# 70 "../../../../src/include/access/tupmacs.h"
#define fetch_att(T,attbyval,attlen) \
( \
(attbyval) ? \
( \
(attlen) == (int) sizeof(int32) ? \
Int32GetDatum(*((int32 *)(T))) \
: \
( \
(attlen) == (int) sizeof(int16) ? \
Int16GetDatum(*((int16 *)(T))) \
: \
( \
AssertMacro((attlen) == 1), \
CharGetDatum(*((char *)(T))) \
) \
) \
) \
: \
PointerGetDatum((char *) (T)) \
)
#endif /* SIZEOF_DATUM >= 8 */
# 92 "../../../../src/include/access/tupmacs.h"
/*
* att_align_datum aligns the given offset as needed for a datum of alignment
* requirement attalign and typlen attlen. attdatum is the Datum variable
* we intend to pack into a tuple (it's only accessed if we are dealing with
* a varlena type). Note that this assumes the Datum will be stored as-is;
* callers that are intending to convert non-short varlena datums to short
* format have to account for that themselves.
*/
#define att_align_datum(cur_offset, attalign, attlen, attdatum) \
( \
((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
(uintptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
/*
* att_align_pointer performs the same calculation as att_align_datum,
* but is used when walking a tuple. attptr is the current actual data
* pointer; when accessing a varlena field we have to "peek" to see if we
* are looking at a pad byte or the first byte of a 1-byte-header datum.
* (A zero byte must be either a pad byte, or the first byte of a correctly
* aligned 4-byte length word; in either case we can align safely. A non-zero
* byte must be either a 1-byte length word, or the first byte of a correctly
* aligned 4-byte length word; in either case we need not align.)
*
* Note: some callers pass a "char *" pointer for cur_offset. This is
* a bit of a hack but should work all right as long as uintptr_t is the
* correct width.
*/
#define att_align_pointer(cur_offset, attalign, attlen, attptr) \
( \
((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
(uintptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
/*
* att_align_nominal aligns the given offset as needed for a datum of alignment
* requirement attalign, ignoring any consideration of packed varlena datums.
* There are three main use cases for using this macro directly:
* * we know that the att in question is not varlena (attlen != -1);
* in this case it is cheaper than the above macros and just as good.
* * we need to estimate alignment padding cost abstractly, ie without
* reference to a real tuple. We must assume the worst case that
* all varlenas are aligned.
* * within arrays, we unconditionally align varlenas (XXX this should be
* revisited, probably).
*
* The attalign cases are tested in what is hopefully something like their
* frequency of occurrence.
*/
#define att_align_nominal(cur_offset, attalign) \
( \
((attalign) == 'i') ? INTALIGN(cur_offset) : \
(((attalign) == 'c') ? (uintptr_t) (cur_offset) : \
(((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
( \
AssertMacro((attalign) == 's'), \
SHORTALIGN(cur_offset) \
))) \
)
/*
* att_addlength_datum increments the given offset by the space needed for
* the given Datum variable. attdatum is only accessed if we are dealing
* with a variable-length attribute.
*/
#define att_addlength_datum(cur_offset, attlen, attdatum) \
att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum))
/*
* att_addlength_pointer performs the same calculation as att_addlength_datum,
* but is used when walking a tuple --- attptr is the pointer to the field
* within the tuple.
*
* Note: some callers pass a "char *" pointer for cur_offset. This is
* actually perfectly OK, but probably should be cleaned up along with
* the same practice for att_align_pointer.
*/
#define att_addlength_pointer(cur_offset, attlen, attptr) \
( \
((attlen) > 0) ? \
( \
(cur_offset) + (attlen) \
) \
: (((attlen) == -1) ? \
( \
(cur_offset) + VARSIZE_ANY(attptr) \
) \
: \
( \
AssertMacro((attlen) == -2), \
(cur_offset) + (strlen((char *) (attptr)) + 1) \
)) \
)
/*
* store_att_byval is a partial inverse of fetch_att: store a given Datum
* value into a tuple data area at the specified address. However, it only
* handles the byval case, because in typical usage the caller needs to
* distinguish by-val and by-ref cases anyway, and so a do-it-all macro
* wouldn't be convenient.
*/
#if SIZEOF_DATUM >= 8
#define store_att_byval(T,newdatum,attlen) \
do { \
switch (attlen) \
{ \
case sizeof(char): \
*(char *) (T) = DatumGetChar(newdatum); \
break; \
case sizeof(int16): \
*(int16 *) (T) = DatumGetInt16(newdatum); \
break; \
case sizeof(int32): \
*(int32 *) (T) = DatumGetInt32(newdatum); \
break; \
case sizeof(int64): \
*(int64 *) (T) = DatumGetInt64(newdatum); \
break; \
default: \
elog(ERROR, "unsupported byval length: %d", \
(int) (attlen)); \
break; \
} \
} while (0)
#else /* SIZEOF_DATUM != 8 */
# 221 "../../../../src/include/access/tupmacs.h"
#define store_att_byval(T,newdatum,attlen) \
do { \
switch (attlen) \
{ \
case sizeof(char): \
*(char *) (T) = DatumGetChar(newdatum); \
break; \
case sizeof(int16): \
*(int16 *) (T) = DatumGetInt16(newdatum); \
break; \
case sizeof(int32): \
*(int32 *) (T) = DatumGetInt32(newdatum); \
break; \
default: \
elog(ERROR, "unsupported byval length: %d", \
(int) (attlen)); \
break; \
} \
} while (0)
#endif /* SIZEOF_DATUM >= 8 */
# 242 "../../../../src/include/access/tupmacs.h"
#endif
# 244 "../../../../src/include/access/tupmacs.h"
# 19 "../../../../src/include/access/itup.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/bufpage.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/itup.h"
# 1 "../../../../src/include/storage/bufpage.h" 1
/*-------------------------------------------------------------------------
*
* bufpage.h
* Standard POSTGRES buffer page definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/bufpage.h
*
*-------------------------------------------------------------------------
*/
#ifndef BUFPAGE_H
#define BUFPAGE_H
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/storage/bufpage.h"
# 18 "../../../../src/include/storage/bufpage.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/storage/bufpage.h"
# 19 "../../../../src/include/storage/bufpage.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/item.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/storage/bufpage.h"
# 1 "../../../../src/include/storage/item.h" 1
/*-------------------------------------------------------------------------
*
* item.h
* POSTGRES disk item definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/item.h
*
*-------------------------------------------------------------------------
*/
#ifndef ITEM_H
#define ITEM_H
typedef Pointer Item;
#endif /* ITEM_H */
# 20 "../../../../src/include/storage/item.h"
# 20 "../../../../src/include/storage/bufpage.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/off.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/storage/bufpage.h"
# 21 "../../../../src/include/storage/bufpage.h"
/*
* A postgres disk page is an abstraction layered on top of a postgres
* disk block (which is simply a unit of i/o, see block.h).
*
* specifically, while a disk block can be unformatted, a postgres
* disk page is always a slotted page of the form:
*
* +----------------+---------------------------------+
* | PageHeaderData | linp1 linp2 linp3 ... |
* +-----------+----+---------------------------------+
* | ... linpN | |
* +-----------+--------------------------------------+
* | ^ pd_lower |
* | |
* | v pd_upper |
* +-------------+------------------------------------+
* | | tupleN ... |
* +-------------+------------------+-----------------+
* | ... tuple3 tuple2 tuple1 | "special space" |
* +--------------------------------+-----------------+
* ^ pd_special
*
* a page is full when nothing can be added between pd_lower and
* pd_upper.
*
* all blocks written out by an access method must be disk pages.
*
* EXCEPTIONS:
*
* obviously, a page is not formatted before it is initialized by
* a call to PageInit.
*
* NOTES:
*
* linp1..N form an ItemId array. ItemPointers point into this array
* rather than pointing directly to a tuple. Note that OffsetNumbers
* conventionally start at 1, not 0.
*
* tuple1..N are added "backwards" on the page. because a tuple's
* ItemPointer points to its ItemId entry rather than its actual
* byte-offset position, tuples can be physically shuffled on a page
* whenever the need arises.
*
* AM-generic per-page information is kept in PageHeaderData.
*
* AM-specific per-page data (if any) is kept in the area marked "special
* space"; each AM has an "opaque" structure defined somewhere that is
* stored as the page trailer. an access method should always
* initialize its pages with PageInit and then set its own opaque
* fields.
*/
typedef Pointer Page;
/*
* location (byte offset) within a page.
*
* note that this is actually limited to 2^15 because we have limited
* ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h).
*/
typedef uint16 LocationIndex;
/*
* For historical reasons, the 64-bit LSN value is stored as two 32-bit
* values.
*/
typedef struct
{
uint32 xlogid; /* high bits */
uint32 xrecoff; /* low bits */
} PageXLogRecPtr;
#define PageXLogRecPtrGet(val) \
((uint64) (val).xlogid << 32 | (val).xrecoff)
#define PageXLogRecPtrSet(ptr, lsn) \
((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn))
/*
* disk page organization
*
* space management information generic to any page
*
* pd_lsn - identifies xlog record for last change to this page.
* pd_checksum - page checksum, if set.
* pd_flags - flag bits.
* pd_lower - offset to start of free space.
* pd_upper - offset to end of free space.
* pd_special - offset to start of special space.
* pd_pagesize_version - size in bytes and page layout version number.
* pd_prune_xid - oldest XID among potentially prunable tuples on page.
*
* The LSN is used by the buffer manager to enforce the basic rule of WAL:
* "thou shalt write xlog before data". A dirty buffer cannot be dumped
* to disk until xlog has been flushed at least as far as the page's LSN.
*
* pd_checksum stores the page checksum, if it has been set for this page;
* zero is a valid value for a checksum. If a checksum is not in use then
* we leave the field unset. This will typically mean the field is zero
* though non-zero values may also be present if databases have been
* pg_upgraded from releases prior to 9.3, when the same byte offset was
* used to store the current timelineid when the page was last updated.
* Note that there is no indication on a page as to whether the checksum
* is valid or not, a deliberate design choice which avoids the problem
* of relying on the page contents to decide whether to verify it. Hence
* there are no flag bits relating to checksums.
*
* pd_prune_xid is a hint field that helps determine whether pruning will be
* useful. It is currently unused in index pages.
*
* The page version number and page size are packed together into a single
* uint16 field. This is for historical reasons: before PostgreSQL 7.3,
* there was no concept of a page version number, and doing it this way
* lets us pretend that pre-7.3 databases have page version number zero.
* We constrain page sizes to be multiples of 256, leaving the low eight
* bits available for a version number.
*
* Minimum possible page size is perhaps 64B to fit page header, opaque space
* and a minimal tuple; of course, in reality you want it much bigger, so
* the constraint on pagesize mod 256 is not an important restriction.
* On the high end, we can only support pages up to 32KB because lp_off/lp_len
* are 15 bits.
*/
typedef struct PageHeaderData
{
/* XXX LSN is member of *any* block, not only page-organized ones */
PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog
* record for last change to this page */
uint16 pd_checksum; /* checksum */
uint16 pd_flags; /* flag bits, see below */
LocationIndex pd_lower; /* offset to start of free space */
LocationIndex pd_upper; /* offset to end of free space */
LocationIndex pd_special; /* offset to start of special space */
uint16 pd_pagesize_version;
TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */
ItemIdData pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */
} PageHeaderData;
typedef PageHeaderData *PageHeader;
/*
* pd_flags contains the following flag bits. Undefined bits are initialized
* to zero and may be used in the future.
*
* PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before
* pd_lower. This should be considered a hint rather than the truth, since
* changes to it are not WAL-logged.
*
* PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the
* page for its new tuple version; this suggests that a prune is needed.
* Again, this is just a hint.
*/
#define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */
#define PD_PAGE_FULL 0x0002 /* not enough free space for new
* tuple? */
#define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to
* everyone */
#define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */
/*
* Page layout version number 0 is for pre-7.3 Postgres releases.
* Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout.
* Release 8.0 uses 2; it changed the HeapTupleHeader layout again.
* Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits.
* Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
* added the pd_flags field (by stealing some bits from pd_tli),
* as well as adding the pd_prune_xid field (which enlarges the header).
*
* As of Release 9.3, the checksum version must also be considered when
* handling pages.
*/
#define PG_PAGE_LAYOUT_VERSION 4
#define PG_DATA_CHECKSUM_VERSION 1
/* ----------------------------------------------------------------
* page support macros
* ----------------------------------------------------------------
*/
/*
* PageIsValid
* True iff page is valid.
*/
#define PageIsValid(page) PointerIsValid(page)
/*
* line pointer(s) do not count as part of header
*/
#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp))
/*
* PageIsEmpty
* returns true iff no itemid has been allocated on the page
*/
#define PageIsEmpty(page) \
(((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData)
/*
* PageIsNew
* returns true iff page has not been initialized (by PageInit)
*/
#define PageIsNew(page) (((PageHeader) (page))->pd_upper == 0)
/*
* PageGetItemId
* Returns an item identifier of a page.
*/
#define PageGetItemId(page, offsetNumber) \
((ItemId) (&((PageHeader) (page))->pd_linp[(offsetNumber) - 1]))
/*
* PageGetContents
* To be used in case the page does not contain item pointers.
*
* Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result.
* Now it is. Beware of old code that might think the offset to the contents
* is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData).
*/
#define PageGetContents(page) \
((char *) (page) + MAXALIGN(SizeOfPageHeaderData))
/* ----------------
* macros to access page size info
* ----------------
*/
/*
* PageSizeIsValid
* True iff the page size is valid.
*/
#define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
/*
* PageGetPageSize
* Returns the page size of a page.
*
* this can only be called on a formatted page (unlike
* BufferGetPageSize, which can be called on an unformatted page).
* however, it can be called on a page that is not stored in a buffer.
*/
#define PageGetPageSize(page) \
((Size) (((PageHeader) (page))->pd_pagesize_version & (uint16) 0xFF00))
/*
* PageGetPageLayoutVersion
* Returns the page layout version of a page.
*/
#define PageGetPageLayoutVersion(page) \
(((PageHeader) (page))->pd_pagesize_version & 0x00FF)
/*
* PageSetPageSizeAndVersion
* Sets the page size and page layout version number of a page.
*
* We could support setting these two values separately, but there's
* no real need for it at the moment.
*/
#define PageSetPageSizeAndVersion(page, size, version) \
( \
AssertMacro(((size) & 0xFF00) == (size)), \
AssertMacro(((version) & 0x00FF) == (version)), \
((PageHeader) (page))->pd_pagesize_version = (size) | (version) \
)
/* ----------------
* page special data macros
* ----------------
*/
/*
* PageGetSpecialSize
* Returns size of special space on a page.
*/
#define PageGetSpecialSize(page) \
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
/*
* Using assertions, validate that the page special pointer is OK.
*
* This is intended to catch use of the pointer before page initialization.
* It is implemented as a function due to the limitations of the MSVC
* compiler, which choked on doing all these tests within another macro. We
* return true so that MacroAssert() can be used while still getting the
* specifics from the macro failure within this function.
*/
static inline bool
PageValidateSpecialPointer(Page page)
{
Assert(PageIsValid(page));
Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
return true;
}
/*
* PageGetSpecialPointer
* Returns pointer to special space on a page.
*/
#define PageGetSpecialPointer(page) \
( \
AssertMacro(PageValidateSpecialPointer(page)), \
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
)
/*
* PageGetItem
* Retrieves an item on the given page.
*
* Note:
* This does not change the status of any of the resources passed.
* The semantics may change in the future.
*/
#define PageGetItem(page, itemId) \
( \
AssertMacro(PageIsValid(page)), \
AssertMacro(ItemIdHasStorage(itemId)), \
(Item)(((char *)(page)) + ItemIdGetOffset(itemId)) \
)
/*
* PageGetMaxOffsetNumber
* Returns the maximum offset number used by the given page.
* Since offset numbers are 1-based, this is also the number
* of items on the page.
*
* NOTE: if the page is not initialized (pd_lower == 0), we must
* return zero to ensure sane behavior. Accept double evaluation
* of the argument so that we can ensure this.
*/
#define PageGetMaxOffsetNumber(page) \
(((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData ? 0 : \
((((PageHeader) (page))->pd_lower - SizeOfPageHeaderData) \
/ sizeof(ItemIdData)))
/*
* Additional macros for access to page headers. (Beware multiple evaluation
* of the arguments!)
*/
#define PageGetLSN(page) \
PageXLogRecPtrGet(((PageHeader) (page))->pd_lsn)
#define PageSetLSN(page, lsn) \
PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
#define PageHasFreeLinePointers(page) \
(((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
#define PageSetHasFreeLinePointers(page) \
(((PageHeader) (page))->pd_flags |= PD_HAS_FREE_LINES)
#define PageClearHasFreeLinePointers(page) \
(((PageHeader) (page))->pd_flags &= ~PD_HAS_FREE_LINES)
#define PageIsFull(page) \
(((PageHeader) (page))->pd_flags & PD_PAGE_FULL)
#define PageSetFull(page) \
(((PageHeader) (page))->pd_flags |= PD_PAGE_FULL)
#define PageClearFull(page) \
(((PageHeader) (page))->pd_flags &= ~PD_PAGE_FULL)
#define PageIsAllVisible(page) \
(((PageHeader) (page))->pd_flags & PD_ALL_VISIBLE)
#define PageSetAllVisible(page) \
(((PageHeader) (page))->pd_flags |= PD_ALL_VISIBLE)
#define PageClearAllVisible(page) \
(((PageHeader) (page))->pd_flags &= ~PD_ALL_VISIBLE)
#define PageIsPrunable(page, oldestxmin) \
( \
AssertMacro(TransactionIdIsNormal(oldestxmin)), \
TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) && \
TransactionIdPrecedes(((PageHeader) (page))->pd_prune_xid, oldestxmin) \
)
#define PageSetPrunable(page, xid) \
do { \
Assert(TransactionIdIsNormal(xid)); \
if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \
TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \
((PageHeader) (page))->pd_prune_xid = (xid); \
} while (0)
#define PageClearPrunable(page) \
(((PageHeader) (page))->pd_prune_xid = InvalidTransactionId)
/* ----------------------------------------------------------------
* extern declarations
* ----------------------------------------------------------------
*/
#define PAI_OVERWRITE (1 << 0)
#define PAI_IS_HEAP (1 << 1)
#define PAI_ALLOW_FAR_OFFSET (1 << 2)
extern void PageInit(Page page, Size pageSize, Size specialSize);
extern bool PageIsVerified(Page page, BlockNumber blkno);
extern OffsetNumber PageAddItem(Page page, Item item, Size size,
OffsetNumber offsetNumber, bool overwrite, bool is_heap);
extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
OffsetNumber offsetNumber, int flags);
extern Page PageGetTempPage(Page page);
extern Page PageGetTempPageCopy(Page page);
extern Page PageGetTempPageCopySpecial(Page page);
extern void PageRestoreTempPage(Page tempPage, Page oldPage);
extern void PageRepairFragmentation(Page page);
extern Size PageGetFreeSpace(Page page);
extern Size PageGetExactFreeSpace(Page page);
extern Size PageGetHeapFreeSpace(Page page);
extern void PageIndexTupleDelete(Page page, OffsetNumber offset);
extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems);
extern void PageIndexDeleteNoCompact(Page page, OffsetNumber *itemnos,
int nitems);
extern char *PageSetChecksumCopy(Page page, BlockNumber blkno);
extern void PageSetChecksumInplace(Page page, BlockNumber blkno);
#endif /* BUFPAGE_H */
# 436 "../../../../src/include/storage/bufpage.h"
# 20 "../../../../src/include/access/itup.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/itemptr.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/access/itup.h"
# 21 "../../../../src/include/access/itup.h"
/*
* Index tuple header structure
*
* All index tuples start with IndexTupleData. If the HasNulls bit is set,
* this is followed by an IndexAttributeBitMapData. The index attribute
* values follow, beginning at a MAXALIGN boundary.
*
* Note that the space allocated for the bitmap does not vary with the number
* of attributes; that is because we don't have room to store the number of
* attributes in the header. Given the MAXALIGN constraint there's no space
* savings to be had anyway, for usual values of INDEX_MAX_KEYS.
*/
typedef struct IndexTupleData
{
ItemPointerData t_tid; /* reference TID to heap tuple */
/* ---------------
* t_info is laid out in the following fashion:
*
* 15th (high) bit: has nulls
* 14th bit: has var-width attributes
* 13th bit: unused
* 12-0 bit: size of tuple
* ---------------
*/
unsigned short t_info; /* various info about tuple */
} IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */
typedef IndexTupleData *IndexTuple;
typedef struct IndexAttributeBitMapData
{
bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8];
} IndexAttributeBitMapData;
typedef IndexAttributeBitMapData *IndexAttributeBitMap;
/*
* t_info manipulation macros
*/
#define INDEX_SIZE_MASK 0x1FFF
/* bit 0x2000 is not used at present */
#define INDEX_VAR_MASK 0x4000
#define INDEX_NULL_MASK 0x8000
#define IndexTupleSize(itup) ((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK))
#define IndexTupleDSize(itup) ((Size) ((itup).t_info & INDEX_SIZE_MASK))
#define IndexTupleHasNulls(itup) ((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK))
#define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))
/*
* Takes an infomask as argument (primarily because this needs to be usable
* at index_form_tuple time so enough space is allocated).
*/
#define IndexInfoFindDataOffset(t_info) \
( \
(!((t_info) & INDEX_NULL_MASK)) ? \
( \
(Size)MAXALIGN(sizeof(IndexTupleData)) \
) \
: \
( \
(Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \
) \
)
/* ----------------
* index_getattr
*
* This gets called many times, so we macro the cacheable and NULL
* lookups, and call nocache_index_getattr() for the rest.
*
* ----------------
*/
#define index_getattr(tup, attnum, tupleDesc, isnull) \
( \
AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \
*(isnull) = false, \
!IndexTupleHasNulls(tup) ? \
( \
(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
( \
fetchatt((tupleDesc)->attrs[(attnum)-1], \
(char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \
+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
) \
: \
nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
: \
( \
(att_isnull((attnum)-1, (char *)(tup) + sizeof(IndexTupleData))) ? \
( \
*(isnull) = true, \
(Datum)NULL \
) \
: \
( \
nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
) \
)
/*
* MaxIndexTuplesPerPage is an upper bound on the number of tuples that can
* fit on one index page. An index tuple must have either data or a null
* bitmap, so we can safely assume it's at least 1 byte bigger than a bare
* IndexTupleData struct. We arrive at the divisor because each tuple
* must be maxaligned, and it must have an associated item pointer.
*/
#define MinIndexTupleSize MAXALIGN(sizeof(IndexTupleData) + 1)
#define MaxIndexTuplesPerPage \
((int) ((BLCKSZ - SizeOfPageHeaderData) / \
(MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData))))
/* routines in indextuple.c */
extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
TupleDesc tupleDesc);
extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern IndexTuple CopyIndexTuple(IndexTuple source);
#endif /* ITUP_H */
# 152 "../../../../src/include/access/itup.h"
# 18 "../../../../src/include/access/spgist_private.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/spgist.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/spgist_private.h"
# 1 "../../../../src/include/access/spgist.h" 1
/*-------------------------------------------------------------------------
*
* spgist.h
* Public header file for SP-GiST access method.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/spgist.h
*
*-------------------------------------------------------------------------
*/
#ifndef SPGIST_H
#define SPGIST_H
#if 0 /* expanded by -frewrite-includes */
#include "access/amapi.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/spgist.h"
# 1 "../../../../src/include/access/amapi.h" 1
/*-------------------------------------------------------------------------
*
* amapi.h
* API for Postgres index access methods.
*
* Copyright (c) 2015-2016, PostgreSQL Global Development Group
*
* src/include/access/amapi.h
*
*-------------------------------------------------------------------------
*/
#ifndef AMAPI_H
#define AMAPI_H
#if 0 /* expanded by -frewrite-includes */
#include "access/genam.h"
#endif /* expanded by -frewrite-includes */
# 15 "../../../../src/include/access/amapi.h"
# 16 "../../../../src/include/access/amapi.h"
/*
* We don't wish to include planner header files here, since most of an index
* AM's implementation isn't concerned with those data structures. To allow
* declaring amcostestimate_function here, use forward struct references.
*/
struct PlannerInfo;
struct IndexPath;
/* Likewise, this file shouldn't depend on execnodes.h. */
struct IndexInfo;
/*
* Properties for amproperty API. This list covers properties known to the
* core code, but an index AM can define its own properties, by matching the
* string property name.
*/
typedef enum IndexAMProperty
{
AMPROP_UNKNOWN = 0, /* anything not known to core code */
AMPROP_ASC, /* column properties */
AMPROP_DESC,
AMPROP_NULLS_FIRST,
AMPROP_NULLS_LAST,
AMPROP_ORDERABLE,
AMPROP_DISTANCE_ORDERABLE,
AMPROP_RETURNABLE,
AMPROP_SEARCH_ARRAY,
AMPROP_SEARCH_NULLS,
AMPROP_CLUSTERABLE, /* index properties */
AMPROP_INDEX_SCAN,
AMPROP_BITMAP_SCAN,
AMPROP_BACKWARD_SCAN,
AMPROP_CAN_ORDER, /* AM properties */
AMPROP_CAN_UNIQUE,
AMPROP_CAN_MULTI_COL,
AMPROP_CAN_EXCLUDE
} IndexAMProperty;
/*
* Callback function signatures --- see indexam.sgml for more info.
*/
/* build new index */
typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation,
Relation indexRelation,
struct IndexInfo *indexInfo);
/* build empty index */
typedef void (*ambuildempty_function) (Relation indexRelation);
/* insert this tuple */
typedef bool (*aminsert_function) (Relation indexRelation,
Datum *values,
bool *isnull,
ItemPointer heap_tid,
Relation heapRelation,
IndexUniqueCheck checkUnique);
/* bulk delete */
typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info,
IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback,
void *callback_state);
/* post-VACUUM cleanup */
typedef IndexBulkDeleteResult *(*amvacuumcleanup_function) (IndexVacuumInfo *info,
IndexBulkDeleteResult *stats);
/* can indexscan return IndexTuples? */
typedef bool (*amcanreturn_function) (Relation indexRelation, int attno);
/* estimate cost of an indexscan */
typedef void (*amcostestimate_function) (struct PlannerInfo *root,
struct IndexPath *path,
double loop_count,
Cost *indexStartupCost,
Cost *indexTotalCost,
Selectivity *indexSelectivity,
double *indexCorrelation);
/* parse index reloptions */
typedef bytea *(*amoptions_function) (Datum reloptions,
bool validate);
/* report AM, index, or index column property */
typedef bool (*amproperty_function) (Oid index_oid, int attno,
IndexAMProperty prop, const char *propname,
bool *res, bool *isnull);
/* validate definition of an opclass for this AM */
typedef bool (*amvalidate_function) (Oid opclassoid);
/* prepare for index scan */
typedef IndexScanDesc (*ambeginscan_function) (Relation indexRelation,
int nkeys,
int norderbys);
/* (re)start index scan */
typedef void (*amrescan_function) (IndexScanDesc scan,
ScanKey keys,
int nkeys,
ScanKey orderbys,
int norderbys);
/* next valid tuple */
typedef bool (*amgettuple_function) (IndexScanDesc scan,
ScanDirection direction);
/* fetch all valid tuples */
typedef int64 (*amgetbitmap_function) (IndexScanDesc scan,
TIDBitmap *tbm);
/* end index scan */
typedef void (*amendscan_function) (IndexScanDesc scan);
/* mark current scan position */
typedef void (*ammarkpos_function) (IndexScanDesc scan);
/* restore marked scan position */
typedef void (*amrestrpos_function) (IndexScanDesc scan);
/*
* API struct for an index AM. Note this must be stored in a single palloc'd
* chunk of memory.
*/
typedef struct IndexAmRoutine
{
NodeTag type;
/*
* Total number of strategies (operators) by which we can traverse/search
* this AM. Zero if AM does not have a fixed set of strategy assignments.
*/
uint16 amstrategies;
/* total number of support functions that this AM uses */
uint16 amsupport;
/* does AM support ORDER BY indexed column's value? */
bool amcanorder;
/* does AM support ORDER BY result of an operator on indexed column? */
bool amcanorderbyop;
/* does AM support backward scanning? */
bool amcanbackward;
/* does AM support UNIQUE indexes? */
bool amcanunique;
/* does AM support multi-column indexes? */
bool amcanmulticol;
/* does AM require scans to have a constraint on the first index column? */
bool amoptionalkey;
/* does AM handle ScalarArrayOpExpr quals? */
bool amsearcharray;
/* does AM handle IS NULL/IS NOT NULL quals? */
bool amsearchnulls;
/* can index storage data type differ from column data type? */
bool amstorage;
/* can an index of this type be clustered on? */
bool amclusterable;
/* does AM handle predicate locks? */
bool ampredlocks;
/* type of data stored in index, or InvalidOid if variable */
Oid amkeytype;
/* interface functions */
ambuild_function ambuild;
ambuildempty_function ambuildempty;
aminsert_function aminsert;
ambulkdelete_function ambulkdelete;
amvacuumcleanup_function amvacuumcleanup;
amcanreturn_function amcanreturn; /* can be NULL */
amcostestimate_function amcostestimate;
amoptions_function amoptions;
amproperty_function amproperty; /* can be NULL */
amvalidate_function amvalidate;
ambeginscan_function ambeginscan;
amrescan_function amrescan;
amgettuple_function amgettuple; /* can be NULL */
amgetbitmap_function amgetbitmap; /* can be NULL */
amendscan_function amendscan;
ammarkpos_function ammarkpos; /* can be NULL */
amrestrpos_function amrestrpos; /* can be NULL */
} IndexAmRoutine;
/* Functions in access/index/amapi.c */
extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid amoid, bool noerror);
extern Datum amvalidate(PG_FUNCTION_ARGS);
#endif /* AMAPI_H */
# 209 "../../../../src/include/access/amapi.h"
# 18 "../../../../src/include/access/spgist.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogreader.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/spgist.h"
# 1 "../../../../src/include/access/xlogreader.h" 1
/*-------------------------------------------------------------------------
*
* xlogreader.h
* Definitions for the generic XLog reading facility
*
* Portions Copyright (c) 2013-2016, PostgreSQL Global Development Group
*
* IDENTIFICATION
* src/include/access/xlogreader.h
*
* NOTES
* See the definition of the XLogReaderState struct for instructions on
* how to use the XLogReader infrastructure.
*
* The basic idea is to allocate an XLogReaderState via
* XLogReaderAllocate(), and call XLogReadRecord() until it returns NULL.
*
* After reading a record with XLogReadRecord(), it's decomposed into
* the per-block and main data parts, and the parts can be accessed
* with the XLogRec* macros and functions. You can also decode a
* record that's already constructed in memory, without reading from
* disk, by calling the DecodeXLogRecord() function.
*-------------------------------------------------------------------------
*/
#ifndef XLOGREADER_H
#define XLOGREADER_H
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogrecord.h"
#endif /* expanded by -frewrite-includes */
# 28 "../../../../src/include/access/xlogreader.h"
# 1 "../../../../src/include/access/xlogrecord.h" 1
/*
* xlogrecord.h
*
* Definitions for the WAL record format.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/xlogrecord.h
*/
#ifndef XLOGRECORD_H
#define XLOGRECORD_H
#if 0 /* expanded by -frewrite-includes */
#include "access/rmgr.h"
#endif /* expanded by -frewrite-includes */
# 14 "../../../../src/include/access/xlogrecord.h"
# 1 "../../../../src/include/access/rmgr.h" 1
/*
* rmgr.h
*
* Resource managers definition
*
* src/include/access/rmgr.h
*/
#ifndef RMGR_H
#define RMGR_H
typedef uint8 RmgrId;
/*
* Built-in resource managers
*
* The actual numerical values for each rmgr ID are defined by the order
* of entries in rmgrlist.h.
*
* Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
* file format.
*/
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \
symname,
typedef enum RmgrIds
{
#if 0 /* expanded by -frewrite-includes */
#include "access/rmgrlist.h"
#endif /* expanded by -frewrite-includes */
# 27 "../../../../src/include/access/rmgr.h"
# 1 "../../../../src/include/access/rmgrlist.h" 1
/*---------------------------------------------------------------------------
* rmgrlist.h
*
* The resource manager list is kept in its own source file for possible
* use by automatic tools. The exact representation of a rmgr is determined
* by the PG_RMGR macro, which is not defined in this file; it can be
* defined by the caller for special purposes.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/rmgrlist.h
*---------------------------------------------------------------------------
*/
/* there is deliberately not an #ifndef RMGRLIST_H here */
/*
* List of resource manager entries. Note that order of entries defines the
* numerical values of each rmgr's ID, which is stored in WAL records. New
* entries should be added at the end, to avoid changing IDs of existing
* entries.
*
* Changes to this list possibly need an XLOG_PAGE_MAGIC bump.
*/
/* symbol name, textual name, redo, desc, identify, startup, cleanup */
PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, xlog_identify, NULL, NULL)
PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, xact_identify, NULL, NULL)
PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, smgr_identify, NULL, NULL)
PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, clog_identify, NULL, NULL)
PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, dbase_identify, NULL, NULL)
PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, tblspc_identify, NULL, NULL)
PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, multixact_identify, NULL, NULL)
PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, relmap_identify, NULL, NULL)
PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, standby_identify, NULL, NULL)
PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, heap2_identify, NULL, NULL)
PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, heap_identify, NULL, NULL)
PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, btree_identify, NULL, NULL)
PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, hash_identify, NULL, NULL)
PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_identify, gin_xlog_startup, gin_xlog_cleanup)
PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_identify, gist_xlog_startup, gist_xlog_cleanup)
PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, seq_identify, NULL, NULL)
PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_identify, spg_xlog_startup, spg_xlog_cleanup)
PG_RMGR(RM_BRIN_ID, "BRIN", brin_redo, brin_desc, brin_identify, NULL, NULL)
PG_RMGR(RM_COMMIT_TS_ID, "CommitTs", commit_ts_redo, commit_ts_desc, commit_ts_identify, NULL, NULL)
PG_RMGR(RM_REPLORIGIN_ID, "ReplicationOrigin", replorigin_redo, replorigin_desc, replorigin_identify, NULL, NULL)
PG_RMGR(RM_GENERIC_ID, "Generic", generic_redo, generic_desc, generic_identify, NULL, NULL)
PG_RMGR(RM_LOGICALMSG_ID, "LogicalMessage", logicalmsg_redo, logicalmsg_desc, logicalmsg_identify, NULL, NULL)
# 28 "../../../../src/include/access/rmgr.h" 2
RM_NEXT_ID
} RmgrIds;
#undef PG_RMGR
#define RM_MAX_ID (RM_NEXT_ID - 1)
#endif /* RMGR_H */
# 36 "../../../../src/include/access/rmgr.h"
# 15 "../../../../src/include/access/xlogrecord.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 15 "../../../../src/include/access/xlogrecord.h"
# 16 "../../../../src/include/access/xlogrecord.h"
#if 0 /* expanded by -frewrite-includes */
#include "port/pg_crc32c.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/access/xlogrecord.h"
# 1 "../../../../src/include/port/pg_crc32c.h" 1
/*-------------------------------------------------------------------------
*
* pg_crc32c.h
* Routines for computing CRC-32C checksums.
*
* The speed of CRC-32C calculation has a big impact on performance, so we
* jump through some hoops to get the best implementation for each
* platform. Some CPU architectures have special instructions for speeding
* up CRC calculations (e.g. Intel SSE 4.2), on other platforms we use the
* Slicing-by-8 algorithm which uses lookup tables.
*
* The public interface consists of four macros:
*
* INIT_CRC32C(crc)
* Initialize a CRC accumulator
*
* COMP_CRC32C(crc, data, len)
* Accumulate some (more) bytes into a CRC
*
* FIN_CRC32C(crc)
* Finish a CRC calculation
*
* EQ_CRC32C(c1, c2)
* Check for equality of two CRCs.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/port/pg_crc32c.h
*
*-------------------------------------------------------------------------
*/
#ifndef PG_CRC32C_H
#define PG_CRC32C_H
#if 0 /* expanded by -frewrite-includes */
#include "port/pg_bswap.h"
#endif /* expanded by -frewrite-includes */
# 36 "../../../../src/include/port/pg_crc32c.h"
# 1 "../../../../src/include/port/pg_bswap.h" 1
/*-------------------------------------------------------------------------
*
* pg_bswap.h
* Byte swapping.
*
* Macros for reversing the byte order of 32-bit and 64-bit unsigned integers.
* For example, 0xAABBCCDD becomes 0xDDCCBBAA. These are just wrappers for
* built-in functions provided by the compiler where support exists.
*
* Note that the GCC built-in functions __builtin_bswap32() and
* __builtin_bswap64() are documented as accepting single arguments of type
* uint32_t and uint64_t respectively (these are also the respective return
* types). Use caution when using these wrapper macros with signed integers.
*
* Copyright (c) 2015-2016, PostgreSQL Global Development Group
*
* src/include/port/pg_bswap.h
*
*-------------------------------------------------------------------------
*/
#ifndef PG_BSWAP_H
#define PG_BSWAP_H
#ifdef HAVE__BUILTIN_BSWAP32
#define BSWAP32(x) __builtin_bswap32(x)
#else
# 27 "../../../../src/include/port/pg_bswap.h"
#define BSWAP32(x) (((x << 24) & 0xff000000) | \
((x << 8) & 0x00ff0000) | \
((x >> 8) & 0x0000ff00) | \
((x >> 24) & 0x000000ff))
#endif /* HAVE__BUILTIN_BSWAP32 */
# 32 "../../../../src/include/port/pg_bswap.h"
#ifdef HAVE__BUILTIN_BSWAP64
#define BSWAP64(x) __builtin_bswap64(x)
#else
# 36 "../../../../src/include/port/pg_bswap.h"
#define BSWAP64(x) (((x << 56) & 0xff00000000000000UL) | \
((x << 40) & 0x00ff000000000000UL) | \
((x << 24) & 0x0000ff0000000000UL) | \
((x << 8) & 0x000000ff00000000UL) | \
((x >> 8) & 0x00000000ff000000UL) | \
((x >> 24) & 0x0000000000ff0000UL) | \
((x >> 40) & 0x000000000000ff00UL) | \
((x >> 56) & 0x00000000000000ffUL))
#endif /* HAVE__BUILTIN_BSWAP64 */
# 45 "../../../../src/include/port/pg_bswap.h"
/*
* Rearrange the bytes of a Datum from big-endian order into the native byte
* order. On big-endian machines, this does nothing at all. Note that the C
* type Datum is an unsigned integer type on all platforms.
*
* One possible application of the DatumBigEndianToNative() macro is to make
* bitwise comparisons cheaper. A simple 3-way comparison of Datums
* transformed by the macro (based on native, unsigned comparisons) will return
* the same result as a memcmp() of the corresponding original Datums, but can
* be much cheaper. It's generally safe to do this on big-endian systems
* without any special transformation occurring first.
*/
#ifdef WORDS_BIGENDIAN
#define DatumBigEndianToNative(x) (x)
#else /* !WORDS_BIGENDIAN */
# 61 "../../../../src/include/port/pg_bswap.h"
#if SIZEOF_DATUM >= 8
#define DatumBigEndianToNative(x) BSWAP64(x)
#else /* SIZEOF_DATUM != 8 */
# 64 "../../../../src/include/port/pg_bswap.h"
#define DatumBigEndianToNative(x) BSWAP32(x)
#endif /* SIZEOF_DATUM >= 8 */
# 66 "../../../../src/include/port/pg_bswap.h"
#endif /* WORDS_BIGENDIAN */
# 67 "../../../../src/include/port/pg_bswap.h"
#endif /* PG_BSWAP_H */
# 69 "../../../../src/include/port/pg_bswap.h"
# 37 "../../../../src/include/port/pg_crc32c.h" 2
typedef uint32 pg_crc32c;
/* The INIT and EQ macros are the same for all implementations. */
#define INIT_CRC32C(crc) ((crc) = 0xFFFFFFFF)
#define EQ_CRC32C(c1, c2) ((c1) == (c2))
#if defined(USE_SSE42_CRC32C)
/* Use SSE4.2 instructions. */
#define COMP_CRC32C(crc, data, len) \
((crc) = pg_comp_crc32c_sse42((crc), (data), (len)))
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
#elif defined(USE_SSE42_CRC32C_WITH_RUNTIME_CHECK)
# 53 "../../../../src/include/port/pg_crc32c.h"
/*
* Use SSE4.2 instructions, but perform a runtime check first to check that
* they are available.
*/
#define COMP_CRC32C(crc, data, len) \
((crc) = pg_comp_crc32c((crc), (data), (len)))
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
#else
# 66 "../../../../src/include/port/pg_crc32c.h"
/*
* Use slicing-by-8 algorithm.
*
* On big-endian systems, the intermediate value is kept in reverse byte
* order, to avoid byte-swapping during the calculation. FIN_CRC32C reverses
* the bytes to the final order.
*/
#define COMP_CRC32C(crc, data, len) \
((crc) = pg_comp_crc32c_sb8((crc), (data), (len)))
#ifdef WORDS_BIGENDIAN
#define FIN_CRC32C(crc) ((crc) = BSWAP32(crc) ^ 0xFFFFFFFF)
#else
# 78 "../../../../src/include/port/pg_crc32c.h"
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
#endif
# 80 "../../../../src/include/port/pg_crc32c.h"
extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
#endif
# 84 "../../../../src/include/port/pg_crc32c.h"
#endif /* PG_CRC32C_H */
# 86 "../../../../src/include/port/pg_crc32c.h"
# 17 "../../../../src/include/access/xlogrecord.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/xlogrecord.h"
# 18 "../../../../src/include/access/xlogrecord.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/relfilenode.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/xlogrecord.h"
# 1 "../../../../src/include/storage/relfilenode.h" 1
/*-------------------------------------------------------------------------
*
* relfilenode.h
* Physical access information for relations.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/relfilenode.h
*
*-------------------------------------------------------------------------
*/
#ifndef RELFILENODE_H
#define RELFILENODE_H
#if 0 /* expanded by -frewrite-includes */
#include "common/relpath.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/storage/relfilenode.h"
# 1 "../../../../src/include/common/relpath.h" 1
/*-------------------------------------------------------------------------
*
* relpath.h
* Declarations for GetRelationPath() and friends
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/common/relpath.h
*
*-------------------------------------------------------------------------
*/
#ifndef RELPATH_H
#define RELPATH_H
/*
* Stuff for fork names.
*
* The physical storage of a relation consists of one or more forks.
* The main fork is always created, but in addition to that there can be
* additional forks for storing various metadata. ForkNumber is used when
* we need to refer to a specific fork in a relation.
*/
typedef enum ForkNumber
{
InvalidForkNumber = -1,
MAIN_FORKNUM = 0,
FSM_FORKNUM,
VISIBILITYMAP_FORKNUM,
INIT_FORKNUM
/*
* NOTE: if you add a new fork, change MAX_FORKNUM and possibly
* FORKNAMECHARS below, and update the forkNames array in
* src/common/relpath.c
*/
} ForkNumber;
#define MAX_FORKNUM INIT_FORKNUM
#define FORKNAMECHARS 4 /* max chars for a fork name */
extern const char *const forkNames[];
extern ForkNumber forkname_to_number(const char *forkName);
extern int forkname_chars(const char *str, ForkNumber *fork);
/*
* Stuff for computing filesystem pathnames for relations.
*/
extern char *GetDatabasePath(Oid dbNode, Oid spcNode);
extern char *GetRelationPath(Oid dbNode, Oid spcNode, Oid relNode,
int backendId, ForkNumber forkNumber);
/*
* Wrapper macros for GetRelationPath. Beware of multiple
* evaluation of the RelFileNode or RelFileNodeBackend argument!
*/
/* First argument is a RelFileNode */
#define relpathbackend(rnode, backend, forknum) \
GetRelationPath((rnode).dbNode, (rnode).spcNode, (rnode).relNode, \
backend, forknum)
/* First argument is a RelFileNode */
#define relpathperm(rnode, forknum) \
relpathbackend(rnode, InvalidBackendId, forknum)
/* First argument is a RelFileNodeBackend */
#define relpath(rnode, forknum) \
relpathbackend((rnode).node, (rnode).backend, forknum)
#endif /* RELPATH_H */
# 75 "../../../../src/include/common/relpath.h"
# 18 "../../../../src/include/storage/relfilenode.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/backendid.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/storage/relfilenode.h"
# 1 "../../../../src/include/storage/backendid.h" 1
/*-------------------------------------------------------------------------
*
* backendid.h
* POSTGRES backend id communication definitions
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/backendid.h
*
*-------------------------------------------------------------------------
*/
#ifndef BACKENDID_H
#define BACKENDID_H
/* ----------------
* -cim 8/17/90
* ----------------
*/
typedef int BackendId; /* unique currently active backend identifier */
#define InvalidBackendId (-1)
extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */
/* backend id of our parallel session leader, or InvalidBackendId if none */
extern PGDLLIMPORT BackendId ParallelMasterBackendId;
/*
* The BackendId to use for our session's temp relations is normally our own,
* but parallel workers should use their leader's ID.
*/
#define BackendIdForTempRelations() \
(ParallelMasterBackendId == InvalidBackendId ? MyBackendId : ParallelMasterBackendId)
#endif /* BACKENDID_H */
# 38 "../../../../src/include/storage/backendid.h"
# 19 "../../../../src/include/storage/relfilenode.h" 2
/*
* RelFileNode must provide all that we need to know to physically access
* a relation, with the exception of the backend ID, which can be provided
* separately. Note, however, that a "physical" relation is comprised of
* multiple files on the filesystem, as each fork is stored as a separate
* file, and each fork can be divided into multiple segments. See md.c.
*
* spcNode identifies the tablespace of the relation. It corresponds to
* pg_tablespace.oid.
*
* dbNode identifies the database of the relation. It is zero for
* "shared" relations (those common to all databases of a cluster).
* Nonzero dbNode values correspond to pg_database.oid.
*
* relNode identifies the specific relation. relNode corresponds to
* pg_class.relfilenode (NOT pg_class.oid, because we need to be able
* to assign new physical files to relations in some situations).
* Notice that relNode is only unique within a database in a particular
* tablespace.
*
* Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is
* zero. We support shared relations only in the "global" tablespace.
*
* Note: in pg_class we allow reltablespace == 0 to denote that the
* relation is stored in its database's "default" tablespace (as
* identified by pg_database.dattablespace). However this shorthand
* is NOT allowed in RelFileNode structs --- the real tablespace ID
* must be supplied when setting spcNode.
*
* Note: in pg_class, relfilenode can be zero to denote that the relation
* is a "mapped" relation, whose current true filenode number is available
* from relmapper.c. Again, this case is NOT allowed in RelFileNodes.
*
* Note: various places use RelFileNode in hashtable keys. Therefore,
* there *must not* be any unused padding bytes in this struct. That
* should be safe as long as all the fields are of type Oid.
*/
typedef struct RelFileNode
{
Oid spcNode; /* tablespace */
Oid dbNode; /* database */
Oid relNode; /* relation */
} RelFileNode;
/*
* Augmenting a relfilenode with the backend ID provides all the information
* we need to locate the physical storage. The backend ID is InvalidBackendId
* for regular relations (those accessible to more than one backend), or the
* owning backend's ID for backend-local relations. Backend-local relations
* are always transient and removed in case of a database crash; they are
* never WAL-logged or fsync'd.
*/
typedef struct RelFileNodeBackend
{
RelFileNode node;
BackendId backend;
} RelFileNodeBackend;
#define RelFileNodeBackendIsTemp(rnode) \
((rnode).backend != InvalidBackendId)
/*
* Note: RelFileNodeEquals and RelFileNodeBackendEquals compare relNode first
* since that is most likely to be different in two unequal RelFileNodes. It
* is probably redundant to compare spcNode if the other fields are found equal,
* but do it anyway to be sure. Likewise for checking the backend ID in
* RelFileNodeBackendEquals.
*/
#define RelFileNodeEquals(node1, node2) \
((node1).relNode == (node2).relNode && \
(node1).dbNode == (node2).dbNode && \
(node1).spcNode == (node2).spcNode)
#define RelFileNodeBackendEquals(node1, node2) \
((node1).node.relNode == (node2).node.relNode && \
(node1).node.dbNode == (node2).node.dbNode && \
(node1).backend == (node2).backend && \
(node1).node.spcNode == (node2).node.spcNode)
#endif /* RELFILENODE_H */
# 100 "../../../../src/include/storage/relfilenode.h"
# 19 "../../../../src/include/access/xlogrecord.h" 2
/*
* The overall layout of an XLOG record is:
* Fixed-size header (XLogRecord struct)
* XLogRecordBlockHeader struct
* XLogRecordBlockHeader struct
* ...
* XLogRecordDataHeader[Short|Long] struct
* block data
* block data
* ...
* main data
*
* There can be zero or more XLogRecordBlockHeaders, and 0 or more bytes of
* rmgr-specific data not associated with a block. XLogRecord structs
* always start on MAXALIGN boundaries in the WAL files, but the rest of
* the fields are not aligned.
*
* The XLogRecordBlockHeader, XLogRecordDataHeaderShort and
* XLogRecordDataHeaderLong structs all begin with a single 'id' byte. It's
* used to distinguish between block references, and the main data structs.
*/
typedef struct XLogRecord
{
uint32 xl_tot_len; /* total len of entire record */
TransactionId xl_xid; /* xact id */
XLogRecPtr xl_prev; /* ptr to previous record in log */
uint8 xl_info; /* flag bits, see below */
RmgrId xl_rmid; /* resource manager for this record */
/* 2 bytes of padding here, initialize to zero */
pg_crc32c xl_crc; /* CRC for this record */
/* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */
} XLogRecord;
#define SizeOfXLogRecord (offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c))
/*
* The high 4 bits in xl_info may be used freely by rmgr. The
* XLR_SPECIAL_REL_UPDATE bit can be passed by XLogInsert caller. The rest
* are set internally by XLogInsert.
*/
#define XLR_INFO_MASK 0x0F
#define XLR_RMGR_INFO_MASK 0xF0
/*
* If a WAL record modifies any relation files, in ways not covered by the
* usual block references, this flag is set. This is not used for anything
* by PostgreSQL itself, but it allows external tools that read WAL and keep
* track of modified blocks to recognize such special record types.
*/
#define XLR_SPECIAL_REL_UPDATE 0x01
/*
* Header info for block data appended to an XLOG record.
*
* 'data_length' is the length of the rmgr-specific payload data associated
* with this block. It does not include the possible full page image, nor
* XLogRecordBlockHeader struct itself.
*
* Note that we don't attempt to align the XLogRecordBlockHeader struct!
* So, the struct must be copied to aligned local storage before use.
*/
typedef struct XLogRecordBlockHeader
{
uint8 id; /* block reference ID */
uint8 fork_flags; /* fork within the relation, and flags */
uint16 data_length; /* number of payload bytes (not including page
* image) */
/* If BKPBLOCK_HAS_IMAGE, an XLogRecordBlockImageHeader struct follows */
/* If BKPBLOCK_SAME_REL is not set, a RelFileNode follows */
/* BlockNumber follows */
} XLogRecordBlockHeader;
#define SizeOfXLogRecordBlockHeader (offsetof(XLogRecordBlockHeader, data_length) + sizeof(uint16))
/*
* Additional header information when a full-page image is included
* (i.e. when BKPBLOCK_HAS_IMAGE is set).
*
* As a trivial form of data compression, the XLOG code is aware that
* PG data pages usually contain an unused "hole" in the middle, which
* contains only zero bytes. If the length of "hole" > 0 then we have removed
* such a "hole" from the stored data (and it's not counted in the
* XLOG record's CRC, either). Hence, the amount of block data actually
* present is BLCKSZ - the length of "hole" bytes.
*
* When wal_compression is enabled, a full page image which "hole" was
* removed is additionally compressed using PGLZ compression algorithm.
* This can reduce the WAL volume, but at some extra cost of CPU spent
* on the compression during WAL logging. In this case, since the "hole"
* length cannot be calculated by subtracting the number of page image bytes
* from BLCKSZ, basically it needs to be stored as an extra information.
* But when no "hole" exists, we can assume that the "hole" length is zero
* and no such an extra information needs to be stored. Note that
* the original version of page image is stored in WAL instead of the
* compressed one if the number of bytes saved by compression is less than
* the length of extra information. Hence, when a page image is successfully
* compressed, the amount of block data actually present is less than
* BLCKSZ - the length of "hole" bytes - the length of extra information.
*/
typedef struct XLogRecordBlockImageHeader
{
uint16 length; /* number of page image bytes */
uint16 hole_offset; /* number of bytes before "hole" */
uint8 bimg_info; /* flag bits, see below */
/*
* If BKPIMAGE_HAS_HOLE and BKPIMAGE_IS_COMPRESSED, an
* XLogRecordBlockCompressHeader struct follows.
*/
} XLogRecordBlockImageHeader;
#define SizeOfXLogRecordBlockImageHeader \
(offsetof(XLogRecordBlockImageHeader, bimg_info) + sizeof(uint8))
/* Information stored in bimg_info */
#define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */
#define BKPIMAGE_IS_COMPRESSED 0x02 /* page image is compressed */
/*
* Extra header information used when page image has "hole" and
* is compressed.
*/
typedef struct XLogRecordBlockCompressHeader
{
uint16 hole_length; /* number of bytes in "hole" */
} XLogRecordBlockCompressHeader;
#define SizeOfXLogRecordBlockCompressHeader \
sizeof(XLogRecordBlockCompressHeader)
/*
* Maximum size of the header for a block reference. This is used to size a
* temporary buffer for constructing the header.
*/
#define MaxSizeOfXLogRecordBlockHeader \
(SizeOfXLogRecordBlockHeader + \
SizeOfXLogRecordBlockImageHeader + \
SizeOfXLogRecordBlockCompressHeader + \
sizeof(RelFileNode) + \
sizeof(BlockNumber))
/*
* The fork number fits in the lower 4 bits in the fork_flags field. The upper
* bits are used for flags.
*/
#define BKPBLOCK_FORK_MASK 0x0F
#define BKPBLOCK_FLAG_MASK 0xF0
#define BKPBLOCK_HAS_IMAGE 0x10 /* block data is an XLogRecordBlockImage */
#define BKPBLOCK_HAS_DATA 0x20
#define BKPBLOCK_WILL_INIT 0x40 /* redo will re-init the page */
#define BKPBLOCK_SAME_REL 0x80 /* RelFileNode omitted, same as previous */
/*
* XLogRecordDataHeaderShort/Long are used for the "main data" portion of
* the record. If the length of the data is less than 256 bytes, the short
* form is used, with a single byte to hold the length. Otherwise the long
* form is used.
*
* (These structs are currently not used in the code, they are here just for
* documentation purposes).
*/
typedef struct XLogRecordDataHeaderShort
{
uint8 id; /* XLR_BLOCK_ID_DATA_SHORT */
uint8 data_length; /* number of payload bytes */
} XLogRecordDataHeaderShort;
#define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2)
typedef struct XLogRecordDataHeaderLong
{
uint8 id; /* XLR_BLOCK_ID_DATA_LONG */
/* followed by uint32 data_length, unaligned */
} XLogRecordDataHeaderLong;
#define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32))
/*
* Block IDs used to distinguish different kinds of record fragments. Block
* references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use
* any ID number in that range (although you should stick to small numbers,
* because the WAL machinery is optimized for that case). A couple of ID
* numbers are reserved to denote the "main" data portion of the record.
*
* The maximum is currently set at 32, quite arbitrarily. Most records only
* need a handful of block references, but there are a few exceptions that
* need more.
*/
#define XLR_MAX_BLOCK_ID 32
#define XLR_BLOCK_ID_DATA_SHORT 255
#define XLR_BLOCK_ID_DATA_LONG 254
#define XLR_BLOCK_ID_ORIGIN 253
#endif /* XLOGRECORD_H */
# 218 "../../../../src/include/access/xlogrecord.h"
# 29 "../../../../src/include/access/xlogreader.h" 2
typedef struct XLogReaderState XLogReaderState;
/* Function type definition for the read_page callback */
typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader,
XLogRecPtr targetPagePtr,
int reqLen,
XLogRecPtr targetRecPtr,
char *readBuf,
TimeLineID *pageTLI);
typedef struct
{
/* Is this block ref in use? */
bool in_use;
/* Identify the block this refers to */
RelFileNode rnode;
ForkNumber forknum;
BlockNumber blkno;
/* copy of the fork_flags field from the XLogRecordBlockHeader */
uint8 flags;
/* Information on full-page image, if any */
bool has_image;
char *bkp_image;
uint16 hole_offset;
uint16 hole_length;
uint16 bimg_len;
uint8 bimg_info;
/* Buffer holding the rmgr-specific data associated with this block */
bool has_data;
char *data;
uint16 data_len;
uint16 data_bufsz;
} DecodedBkpBlock;
struct XLogReaderState
{
/* ----------------------------------------
* Public parameters
* ----------------------------------------
*/
/*
* Data input callback (mandatory).
*
* This callback shall read at least reqLen valid bytes of the xlog page
* starting at targetPagePtr, and store them in readBuf. The callback
* shall return the number of bytes read (never more than XLOG_BLCKSZ), or
* -1 on failure. The callback shall sleep, if necessary, to wait for the
* requested bytes to become available. The callback will not be invoked
* again for the same page unless more than the returned number of bytes
* are needed.
*
* targetRecPtr is the position of the WAL record we're reading. Usually
* it is equal to targetPagePtr + reqLen, but sometimes xlogreader needs
* to read and verify the page or segment header, before it reads the
* actual WAL record it's interested in. In that case, targetRecPtr can
* be used to determine which timeline to read the page from.
*
* The callback shall set *pageTLI to the TLI of the file the page was
* read from. It is currently used only for error reporting purposes, to
* reconstruct the name of the WAL file where an error occurred.
*/
XLogPageReadCB read_page;
/*
* System identifier of the xlog files we're about to read. Set to zero
* (the default value) if unknown or unimportant.
*/
uint64 system_identifier;
/*
* Opaque data for callbacks to use. Not used by XLogReader.
*/
void *private_data;
/*
* Start and end point of last record read. EndRecPtr is also used as the
* position to read next, if XLogReadRecord receives an invalid recptr.
*/
XLogRecPtr ReadRecPtr; /* start of last record read */
XLogRecPtr EndRecPtr; /* end+1 of last record read */
/* ----------------------------------------
* Decoded representation of current record
*
* Use XLogRecGet* functions to investigate the record; these fields
* should not be accessed directly.
* ----------------------------------------
*/
XLogRecord *decoded_record; /* currently decoded record */
char *main_data; /* record's main data portion */
uint32 main_data_len; /* main data portion's length */
uint32 main_data_bufsz; /* allocated size of the buffer */
RepOriginId record_origin;
/* information about blocks referenced by the record. */
DecodedBkpBlock blocks[XLR_MAX_BLOCK_ID + 1];
int max_block_id; /* highest block_id in use (-1 if none) */
/* ----------------------------------------
* private/internal state
* ----------------------------------------
*/
/*
* Buffer for currently read page (XLOG_BLCKSZ bytes, valid up to at least
* readLen bytes)
*/
char *readBuf;
uint32 readLen;
/* last read segment, segment offset, TLI for data currently in readBuf */
XLogSegNo readSegNo;
uint32 readOff;
TimeLineID readPageTLI;
/*
* beginning of prior page read, and its TLI. Doesn't necessarily
* correspond to what's in readBuf; used for timeline sanity checks.
*/
XLogRecPtr latestPagePtr;
TimeLineID latestPageTLI;
/* beginning of the WAL record being read. */
XLogRecPtr currRecPtr;
/* Buffer for current ReadRecord result (expandable) */
char *readRecordBuf;
uint32 readRecordBufSize;
/* Buffer to hold error message */
char *errormsg_buf;
};
/* Get a new XLogReader */
extern XLogReaderState *XLogReaderAllocate(XLogPageReadCB pagereadfunc,
void *private_data);
/* Free an XLogReader */
extern void XLogReaderFree(XLogReaderState *state);
/* Read the next XLog record. Returns NULL on end-of-WAL or failure */
extern struct XLogRecord *XLogReadRecord(XLogReaderState *state,
XLogRecPtr recptr, char **errormsg);
/* Invalidate read state */
extern void XLogReaderInvalReadState(XLogReaderState *state);
#ifdef FRONTEND
extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr);
#endif /* FRONTEND */
# 189 "../../../../src/include/access/xlogreader.h"
/* Functions for decoding an XLogRecord */
extern bool DecodeXLogRecord(XLogReaderState *state, XLogRecord *record,
char **errmsg);
#define XLogRecGetTotalLen(decoder) ((decoder)->decoded_record->xl_tot_len)
#define XLogRecGetPrev(decoder) ((decoder)->decoded_record->xl_prev)
#define XLogRecGetInfo(decoder) ((decoder)->decoded_record->xl_info)
#define XLogRecGetRmid(decoder) ((decoder)->decoded_record->xl_rmid)
#define XLogRecGetXid(decoder) ((decoder)->decoded_record->xl_xid)
#define XLogRecGetOrigin(decoder) ((decoder)->record_origin)
#define XLogRecGetData(decoder) ((decoder)->main_data)
#define XLogRecGetDataLen(decoder) ((decoder)->main_data_len)
#define XLogRecHasAnyBlockRefs(decoder) ((decoder)->max_block_id >= 0)
#define XLogRecHasBlockRef(decoder, block_id) \
((decoder)->blocks[block_id].in_use)
#define XLogRecHasBlockImage(decoder, block_id) \
((decoder)->blocks[block_id].has_image)
extern bool RestoreBlockImage(XLogReaderState *recoder, uint8 block_id, char *dst);
extern char *XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len);
extern bool XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
RelFileNode *rnode, ForkNumber *forknum,
BlockNumber *blknum);
#endif /* XLOGREADER_H */
# 216 "../../../../src/include/access/xlogreader.h"
# 19 "../../../../src/include/access/spgist.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "fmgr.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/spgist.h"
# 20 "../../../../src/include/access/spgist.h"
#if 0 /* expanded by -frewrite-includes */
#include "lib/stringinfo.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/access/spgist.h"
# 21 "../../../../src/include/access/spgist.h"
/* reloption parameters */
#define SPGIST_MIN_FILLFACTOR 10
#define SPGIST_DEFAULT_FILLFACTOR 80
/* SPGiST opclass support function numbers */
#define SPGIST_CONFIG_PROC 1
#define SPGIST_CHOOSE_PROC 2
#define SPGIST_PICKSPLIT_PROC 3
#define SPGIST_INNER_CONSISTENT_PROC 4
#define SPGIST_LEAF_CONSISTENT_PROC 5
#define SPGISTNProc 5
/*
* Argument structs for spg_config method
*/
typedef struct spgConfigIn
{
Oid attType; /* Data type to be indexed */
} spgConfigIn;
typedef struct spgConfigOut
{
Oid prefixType; /* Data type of inner-tuple prefixes */
Oid labelType; /* Data type of inner-tuple node labels */
bool canReturnData; /* Opclass can reconstruct original data */
bool longValuesOK; /* Opclass can cope with values > 1 page */
} spgConfigOut;
/*
* Argument structs for spg_choose method
*/
typedef struct spgChooseIn
{
Datum datum; /* original datum to be indexed */
Datum leafDatum; /* current datum to be stored at leaf */
int level; /* current level (counting from zero) */
/* Data from current inner tuple */
bool allTheSame; /* tuple is marked all-the-same? */
bool hasPrefix; /* tuple has a prefix? */
Datum prefixDatum; /* if so, the prefix value */
int nNodes; /* number of nodes in the inner tuple */
Datum *nodeLabels; /* node label values (NULL if none) */
} spgChooseIn;
typedef enum spgChooseResultType
{
spgMatchNode = 1, /* descend into existing node */
spgAddNode, /* add a node to the inner tuple */
spgSplitTuple /* split inner tuple (change its prefix) */
} spgChooseResultType;
typedef struct spgChooseOut
{
spgChooseResultType resultType; /* action code, see above */
union
{
struct /* results for spgMatchNode */
{
int nodeN; /* descend to this node (index from 0) */
int levelAdd; /* increment level by this much */
Datum restDatum; /* new leaf datum */
} matchNode;
struct /* results for spgAddNode */
{
Datum nodeLabel; /* new node's label */
int nodeN; /* where to insert it (index from 0) */
} addNode;
struct /* results for spgSplitTuple */
{
/* Info to form new inner tuple with one node */
bool prefixHasPrefix; /* tuple should have a prefix? */
Datum prefixPrefixDatum; /* if so, its value */
Datum nodeLabel; /* node's label */
/* Info to form new lower-level inner tuple with all old nodes */
bool postfixHasPrefix; /* tuple should have a prefix? */
Datum postfixPrefixDatum; /* if so, its value */
} splitTuple;
} result;
} spgChooseOut;
/*
* Argument structs for spg_picksplit method
*/
typedef struct spgPickSplitIn
{
int nTuples; /* number of leaf tuples */
Datum *datums; /* their datums (array of length nTuples) */
int level; /* current level (counting from zero) */
} spgPickSplitIn;
typedef struct spgPickSplitOut
{
bool hasPrefix; /* new inner tuple should have a prefix? */
Datum prefixDatum; /* if so, its value */
int nNodes; /* number of nodes for new inner tuple */
Datum *nodeLabels; /* their labels (or NULL for no labels) */
int *mapTuplesToNodes; /* node index for each leaf tuple */
Datum *leafTupleDatums; /* datum to store in each new leaf tuple */
} spgPickSplitOut;
/*
* Argument structs for spg_inner_consistent method
*/
typedef struct spgInnerConsistentIn
{
ScanKey scankeys; /* array of operators and comparison values */
int nkeys; /* length of array */
Datum reconstructedValue; /* value reconstructed at parent */
void *traversalValue; /* opclass-specific traverse value */
MemoryContext traversalMemoryContext;
int level; /* current level (counting from zero) */
bool returnData; /* original data must be returned? */
/* Data from current inner tuple */
bool allTheSame; /* tuple is marked all-the-same? */
bool hasPrefix; /* tuple has a prefix? */
Datum prefixDatum; /* if so, the prefix value */
int nNodes; /* number of nodes in the inner tuple */
Datum *nodeLabels; /* node label values (NULL if none) */
} spgInnerConsistentIn;
typedef struct spgInnerConsistentOut
{
int nNodes; /* number of child nodes to be visited */
int *nodeNumbers; /* their indexes in the node array */
int *levelAdds; /* increment level by this much for each */
Datum *reconstructedValues; /* associated reconstructed values */
void **traversalValues; /* opclass-specific traverse values */
} spgInnerConsistentOut;
/*
* Argument structs for spg_leaf_consistent method
*/
typedef struct spgLeafConsistentIn
{
ScanKey scankeys; /* array of operators and comparison values */
int nkeys; /* length of array */
void *traversalValue; /* opclass-specific traverse value */
Datum reconstructedValue; /* value reconstructed at parent */
int level; /* current level (counting from zero) */
bool returnData; /* original data must be returned? */
Datum leafDatum; /* datum in leaf tuple */
} spgLeafConsistentIn;
typedef struct spgLeafConsistentOut
{
Datum leafValue; /* reconstructed original data, if any */
bool recheck; /* set true if operator must be rechecked */
} spgLeafConsistentOut;
/* spgutils.c */
extern Datum spghandler(PG_FUNCTION_ARGS);
extern bytea *spgoptions(Datum reloptions, bool validate);
/* spginsert.c */
extern IndexBuildResult *spgbuild(Relation heap, Relation index,
struct IndexInfo *indexInfo);
extern void spgbuildempty(Relation index);
extern bool spginsert(Relation index, Datum *values, bool *isnull,
ItemPointer ht_ctid, Relation heapRel,
IndexUniqueCheck checkUnique);
/* spgscan.c */
extern IndexScanDesc spgbeginscan(Relation rel, int keysz, int orderbysz);
extern void spgendscan(IndexScanDesc scan);
extern void spgrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
ScanKey orderbys, int norderbys);
extern int64 spggetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
extern bool spggettuple(IndexScanDesc scan, ScanDirection dir);
extern bool spgcanreturn(Relation index, int attno);
/* spgvacuum.c */
extern IndexBulkDeleteResult *spgbulkdelete(IndexVacuumInfo *info,
IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback,
void *callback_state);
extern IndexBulkDeleteResult *spgvacuumcleanup(IndexVacuumInfo *info,
IndexBulkDeleteResult *stats);
/* spgvalidate.c */
extern bool spgvalidate(Oid opclassoid);
/* spgxlog.c */
extern void spg_redo(XLogReaderState *record);
extern void spg_desc(StringInfo buf, XLogReaderState *record);
extern const char *spg_identify(uint8 info);
extern void spg_xlog_startup(void);
extern void spg_xlog_cleanup(void);
#endif /* SPGIST_H */
# 221 "../../../../src/include/access/spgist.h"
# 19 "../../../../src/include/access/spgist_private.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "nodes/tidbitmap.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/spgist_private.h"
# 20 "../../../../src/include/access/spgist_private.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/buf.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/access/spgist_private.h"
# 21 "../../../../src/include/access/spgist_private.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/relcache.h"
#endif /* expanded by -frewrite-includes */
# 21 "../../../../src/include/access/spgist_private.h"
# 22 "../../../../src/include/access/spgist_private.h"
/* Page numbers of fixed-location pages */
#define SPGIST_METAPAGE_BLKNO (0) /* metapage */
#define SPGIST_ROOT_BLKNO (1) /* root for normal entries */
#define SPGIST_NULL_BLKNO (2) /* root for null-value entries */
#define SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO
#define SpGistBlockIsRoot(blkno) \
((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO)
#define SpGistBlockIsFixed(blkno) \
((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO)
/*
* Contents of page special space on SPGiST index pages
*/
typedef struct SpGistPageOpaqueData
{
uint16 flags; /* see bit definitions below */
uint16 nRedirection; /* number of redirection tuples on page */
uint16 nPlaceholder; /* number of placeholder tuples on page */
/* note there's no count of either LIVE or DEAD tuples ... */
uint16 spgist_page_id; /* for identification of SP-GiST indexes */
} SpGistPageOpaqueData;
typedef SpGistPageOpaqueData *SpGistPageOpaque;
/* Flag bits in page special space */
#define SPGIST_META (1<<0)
#define SPGIST_DELETED (1<<1) /* never set, but keep for backwards
* compatibility */
#define SPGIST_LEAF (1<<2)
#define SPGIST_NULLS (1<<3)
#define SpGistPageGetOpaque(page) ((SpGistPageOpaque) PageGetSpecialPointer(page))
#define SpGistPageIsMeta(page) (SpGistPageGetOpaque(page)->flags & SPGIST_META)
#define SpGistPageIsDeleted(page) (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED)
#define SpGistPageIsLeaf(page) (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF)
#define SpGistPageStoresNulls(page) (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS)
/*
* The page ID is for the convenience of pg_filedump and similar utilities,
* which otherwise would have a hard time telling pages of different index
* types apart. It should be the last 2 bytes on the page. This is more or
* less "free" due to alignment considerations.
*
* See comments above GinPageOpaqueData.
*/
#define SPGIST_PAGE_ID 0xFF82
/*
* Each backend keeps a cache of last-used page info in its index->rd_amcache
* area. This is initialized from, and occasionally written back to,
* shared storage in the index metapage.
*/
typedef struct SpGistLastUsedPage
{
BlockNumber blkno; /* block number, or InvalidBlockNumber */
int freeSpace; /* page's free space (could be obsolete!) */
} SpGistLastUsedPage;
/* Note: indexes in cachedPage[] match flag assignments for SpGistGetBuffer */
#define SPGIST_CACHED_PAGES 8
typedef struct SpGistLUPCache
{
SpGistLastUsedPage cachedPage[SPGIST_CACHED_PAGES];
} SpGistLUPCache;
/*
* metapage
*/
typedef struct SpGistMetaPageData
{
uint32 magicNumber; /* for identity cross-check */
SpGistLUPCache lastUsedPages; /* shared storage of last-used info */
} SpGistMetaPageData;
#define SPGIST_MAGIC_NUMBER (0xBA0BABEE)
#define SpGistPageGetMeta(p) \
((SpGistMetaPageData *) PageGetContents(p))
/*
* Private state of index AM. SpGistState is common to both insert and
* search code; SpGistScanOpaque is for searches only.
*/
/* Per-datatype info needed in SpGistState */
typedef struct SpGistTypeDesc
{
Oid type;
bool attbyval;
int16 attlen;
} SpGistTypeDesc;
typedef struct SpGistState
{
spgConfigOut config; /* filled in by opclass config method */
SpGistTypeDesc attType; /* type of input data and leaf values */
SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */
SpGistTypeDesc attLabelType; /* type of node label values */
char *deadTupleStorage; /* workspace for spgFormDeadTuple */
TransactionId myXid; /* XID to use when creating a redirect tuple */
bool isBuild; /* true if doing index build */
} SpGistState;
/*
* Private state of an index scan
*/
typedef struct SpGistScanOpaqueData
{
SpGistState state; /* see above */
MemoryContext tempCxt; /* short-lived memory context */
/* Control flags showing whether to search nulls and/or non-nulls */
bool searchNulls; /* scan matches (all) null entries */
bool searchNonNulls; /* scan matches (some) non-null entries */
/* Index quals to be passed to opclass (null-related quals removed) */
int numberOfKeys; /* number of index qualifier conditions */
ScanKey keyData; /* array of index qualifier descriptors */
/* Stack of yet-to-be-visited pages */
List *scanStack; /* List of ScanStackEntrys */
/* These fields are only used in amgetbitmap scans: */
TIDBitmap *tbm; /* bitmap being filled */
int64 ntids; /* number of TIDs passed to bitmap */
/* These fields are only used in amgettuple scans: */
bool want_itup; /* are we reconstructing tuples? */
TupleDesc indexTupDesc; /* if so, tuple descriptor for them */
int nPtrs; /* number of TIDs found on current page */
int iPtr; /* index for scanning through same */
ItemPointerData heapPtrs[MaxIndexTuplesPerPage]; /* TIDs from cur page */
bool recheck[MaxIndexTuplesPerPage]; /* their recheck flags */
IndexTuple indexTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */
/*
* Note: using MaxIndexTuplesPerPage above is a bit hokey since
* SpGistLeafTuples aren't exactly IndexTuples; however, they are larger,
* so this is safe.
*/
} SpGistScanOpaqueData;
typedef SpGistScanOpaqueData *SpGistScanOpaque;
/*
* This struct is what we actually keep in index->rd_amcache. It includes
* static configuration information as well as the lastUsedPages cache.
*/
typedef struct SpGistCache
{
spgConfigOut config; /* filled in by opclass config method */
SpGistTypeDesc attType; /* type of input data and leaf values */
SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */
SpGistTypeDesc attLabelType; /* type of node label values */
SpGistLUPCache lastUsedPages; /* local storage of last-used info */
} SpGistCache;
/*
* SPGiST tuple types. Note: inner, leaf, and dead tuple structs
* must have the same tupstate field in the same position! Real inner and
* leaf tuples always have tupstate = LIVE; if the state is something else,
* use the SpGistDeadTuple struct to inspect the tuple.
*/
/* values of tupstate (see README for more info) */
#define SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */
#define SPGIST_REDIRECT 1 /* temporary redirection placeholder */
#define SPGIST_DEAD 2 /* dead, cannot be removed because of links */
#define SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */
/*
* SPGiST inner tuple: list of "nodes" that subdivide a set of tuples
*
* Inner tuple layout:
* header/optional prefix/array of nodes, which are SpGistNodeTuples
*
* size and prefixSize must be multiples of MAXALIGN
*/
typedef struct SpGistInnerTupleData
{
unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */
allTheSame:1, /* all nodes in tuple are equivalent */
nNodes:13, /* number of nodes within inner tuple */
prefixSize:16; /* size of prefix, or 0 if none */
uint16 size; /* total size of inner tuple */
/* On most machines there will be a couple of wasted bytes here */
/* prefix datum follows, then nodes */
} SpGistInnerTupleData;
typedef SpGistInnerTupleData *SpGistInnerTuple;
/* these must match largest values that fit in bit fields declared above */
#define SGITMAXNNODES 0x1FFF
#define SGITMAXPREFIXSIZE 0xFFFF
#define SGITMAXSIZE 0xFFFF
#define SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData))
#define _SGITDATA(x) (((char *) (x)) + SGITHDRSZ)
#define SGITDATAPTR(x) ((x)->prefixSize ? _SGITDATA(x) : NULL)
#define SGITDATUM(x, s) ((x)->prefixSize ? \
((s)->attPrefixType.attbyval ? \
*(Datum *) _SGITDATA(x) : \
PointerGetDatum(_SGITDATA(x))) \
: (Datum) 0)
#define SGITNODEPTR(x) ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize))
/* Macro for iterating through the nodes of an inner tuple */
#define SGITITERATE(x, i, nt) \
for ((i) = 0, (nt) = SGITNODEPTR(x); \
(i) < (x)->nNodes; \
(i)++, (nt) = (SpGistNodeTuple) (((char *) (nt)) + IndexTupleSize(nt)))
/*
* SPGiST node tuple: one node within an inner tuple
*
* Node tuples use the same header as ordinary Postgres IndexTuples, but
* we do not use a null bitmap, because we know there is only one column
* so the INDEX_NULL_MASK bit suffices. Also, pass-by-value datums are
* stored as a full Datum, the same convention as for inner tuple prefixes
* and leaf tuple datums.
*/
typedef IndexTupleData SpGistNodeTupleData;
typedef SpGistNodeTupleData *SpGistNodeTuple;
#define SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData))
#define SGNTDATAPTR(x) (((char *) (x)) + SGNTHDRSZ)
#define SGNTDATUM(x, s) ((s)->attLabelType.attbyval ? \
*(Datum *) SGNTDATAPTR(x) : \
PointerGetDatum(SGNTDATAPTR(x)))
/*
* SPGiST leaf tuple: carries a datum and a heap tuple TID
*
* In the simplest case, the datum is the same as the indexed value; but
* it could also be a suffix or some other sort of delta that permits
* reconstruction given knowledge of the prefix path traversed to get here.
*
* The size field is wider than could possibly be needed for an on-disk leaf
* tuple, but this allows us to form leaf tuples even when the datum is too
* wide to be stored immediately, and it costs nothing because of alignment
* considerations.
*
* Normally, nextOffset links to the next tuple belonging to the same parent
* node (which must be on the same page). But when the root page is a leaf
* page, we don't chain its tuples, so nextOffset is always 0 on the root.
*
* size must be a multiple of MAXALIGN; also, it must be at least SGDTSIZE
* so that the tuple can be converted to REDIRECT status later. (This
* restriction only adds bytes for the null-datum case, otherwise alignment
* restrictions force it anyway.)
*
* In a leaf tuple for a NULL indexed value, there's no useful datum value;
* however, the SGDTSIZE limit ensures that's there's a Datum word there
* anyway, so SGLTDATUM can be applied safely as long as you don't do
* anything with the result.
*/
typedef struct SpGistLeafTupleData
{
unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */
size:30; /* large enough for any palloc'able value */
OffsetNumber nextOffset; /* next tuple in chain, or InvalidOffset */
ItemPointerData heapPtr; /* TID of represented heap tuple */
/* leaf datum follows */
} SpGistLeafTupleData;
typedef SpGistLeafTupleData *SpGistLeafTuple;
#define SGLTHDRSZ MAXALIGN(sizeof(SpGistLeafTupleData))
#define SGLTDATAPTR(x) (((char *) (x)) + SGLTHDRSZ)
#define SGLTDATUM(x, s) ((s)->attType.attbyval ? \
*(Datum *) SGLTDATAPTR(x) : \
PointerGetDatum(SGLTDATAPTR(x)))
/*
* SPGiST dead tuple: declaration for examining non-live tuples
*
* The tupstate field of this struct must match those of regular inner and
* leaf tuples, and its size field must match a leaf tuple's.
* Also, the pointer field must be in the same place as a leaf tuple's heapPtr
* field, to satisfy some Asserts that we make when replacing a leaf tuple
* with a dead tuple.
* We don't use nextOffset, but it's needed to align the pointer field.
* pointer and xid are only valid when tupstate = REDIRECT.
*/
typedef struct SpGistDeadTupleData
{
unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */
size:30;
OffsetNumber nextOffset; /* not used in dead tuples */
ItemPointerData pointer; /* redirection inside index */
TransactionId xid; /* ID of xact that inserted this tuple */
} SpGistDeadTupleData;
typedef SpGistDeadTupleData *SpGistDeadTuple;
#define SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData))
/*
* Macros for doing free-space calculations. Note that when adding up the
* space needed for tuples, we always consider each tuple to need the tuple's
* size plus sizeof(ItemIdData) (for the line pointer). This works correctly
* so long as tuple sizes are always maxaligned.
*/
/* Page capacity after allowing for fixed header and special space */
#define SPGIST_PAGE_CAPACITY \
((size_t)MAXALIGN_DOWN(BLCKSZ - \
SizeOfPageHeaderData - \
MAXALIGN(sizeof(SpGistPageOpaqueData))))
/*
* Compute free space on page, assuming that up to n placeholders can be
* recycled if present (n should be the number of tuples to be inserted)
*/
#define SpGistPageGetFreeSpace(p, n) \
(PageGetExactFreeSpace(p) + \
Min(SpGistPageGetOpaque(p)->nPlaceholder, n) * \
(SGDTSIZE + sizeof(ItemIdData)))
/*
* XLOG stuff
*/
/* XLOG record types for SPGiST */
#define XLOG_SPGIST_CREATE_INDEX 0x00
#define XLOG_SPGIST_ADD_LEAF 0x10
#define XLOG_SPGIST_MOVE_LEAFS 0x20
#define XLOG_SPGIST_ADD_NODE 0x30
#define XLOG_SPGIST_SPLIT_TUPLE 0x40
#define XLOG_SPGIST_PICKSPLIT 0x50
#define XLOG_SPGIST_VACUUM_LEAF 0x60
#define XLOG_SPGIST_VACUUM_ROOT 0x70
#define XLOG_SPGIST_VACUUM_REDIRECT 0x80
/*
* Some redo functions need an SpGistState, although only a few of its fields
* need to be valid. spgxlogState carries the required info in xlog records.
* (See fillFakeState in spgxlog.c for more comments.)
*/
typedef struct spgxlogState
{
TransactionId myXid;
bool isBuild;
} spgxlogState;
#define STORE_STATE(s, d) \
do { \
(d).myXid = (s)->myXid; \
(d).isBuild = (s)->isBuild; \
} while(0)
/*
* Backup Blk 0: destination page for leaf tuple
* Backup Blk 1: parent page (if any)
*/
typedef struct spgxlogAddLeaf
{
bool newPage; /* init dest page? */
bool storesNulls; /* page is in the nulls tree? */
OffsetNumber offnumLeaf; /* offset where leaf tuple gets placed */
OffsetNumber offnumHeadLeaf; /* offset of head tuple in chain, if any */
OffsetNumber offnumParent; /* where the parent downlink is, if any */
uint16 nodeI;
/* new leaf tuple follows (unaligned!) */
} spgxlogAddLeaf;
/*
* Backup Blk 0: source leaf page
* Backup Blk 1: destination leaf page
* Backup Blk 2: parent page
*/
typedef struct spgxlogMoveLeafs
{
uint16 nMoves; /* number of tuples moved from source page */
bool newPage; /* init dest page? */
bool replaceDead; /* are we replacing a DEAD source tuple? */
bool storesNulls; /* pages are in the nulls tree? */
/* where the parent downlink is */
OffsetNumber offnumParent;
uint16 nodeI;
spgxlogState stateSrc;
/*----------
* data follows:
* array of deleted tuple numbers, length nMoves
* array of inserted tuple numbers, length nMoves + 1 or 1
* list of leaf tuples, length nMoves + 1 or 1 (unaligned!)
*
* Note: if replaceDead is true then there is only one inserted tuple
* number and only one leaf tuple in the data, because we are not copying
* the dead tuple from the source
*----------
*/
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} spgxlogMoveLeafs;
#define SizeOfSpgxlogMoveLeafs offsetof(spgxlogMoveLeafs, offsets)
/*
* Backup Blk 0: original page
* Backup Blk 1: where new tuple goes, if not same place
* Backup Blk 2: where parent downlink is, if updated and different from
* the old and new
*/
typedef struct spgxlogAddNode
{
/*
* Offset of the original inner tuple, in the original page (on backup
* block 0).
*/
OffsetNumber offnum;
/*
* Offset of the new tuple, on the new page (on backup block 1). Invalid,
* if we overwrote the old tuple in the original page).
*/
OffsetNumber offnumNew;
bool newPage; /* init new page? */
/*----
* Where is the parent downlink? parentBlk indicates which page it's on,
* and offnumParent is the offset within the page. The possible values for
* parentBlk are:
*
* 0: parent == original page
* 1: parent == new page
* 2: parent == different page (blk ref 2)
* -1: parent not updated
*----
*/
int8 parentBlk;
OffsetNumber offnumParent; /* offset within the parent page */
uint16 nodeI;
spgxlogState stateSrc;
/*
* updated inner tuple follows (unaligned!)
*/
} spgxlogAddNode;
/*
* Backup Blk 0: where the prefix tuple goes
* Backup Blk 1: where the postfix tuple goes (if different page)
*/
typedef struct spgxlogSplitTuple
{
/* where the prefix tuple goes */
OffsetNumber offnumPrefix;
/* where the postfix tuple goes */
OffsetNumber offnumPostfix;
bool newPage; /* need to init that page? */
bool postfixBlkSame; /* was postfix tuple put on same page as
* prefix? */
/*
* new prefix inner tuple follows, then new postfix inner tuple (both are
* unaligned!)
*/
} spgxlogSplitTuple;
/*
* Buffer references in the rdata array are:
* Backup Blk 0: Src page (only if not root)
* Backup Blk 1: Dest page (if used)
* Backup Blk 2: Inner page
* Backup Blk 3: Parent page (if any, and different from Inner)
*/
typedef struct spgxlogPickSplit
{
bool isRootSplit;
uint16 nDelete; /* n to delete from Src */
uint16 nInsert; /* n to insert on Src and/or Dest */
bool initSrc; /* re-init the Src page? */
bool initDest; /* re-init the Dest page? */
/* where to put new inner tuple */
OffsetNumber offnumInner;
bool initInner; /* re-init the Inner page? */
bool storesNulls; /* pages are in the nulls tree? */
/* where the parent downlink is, if any */
bool innerIsParent; /* is parent the same as inner page? */
OffsetNumber offnumParent;
uint16 nodeI;
spgxlogState stateSrc;
/*----------
* data follows:
* array of deleted tuple numbers, length nDelete
* array of inserted tuple numbers, length nInsert
* array of page selector bytes for inserted tuples, length nInsert
* new inner tuple (unaligned!)
* list of leaf tuples, length nInsert (unaligned!)
*----------
*/
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} spgxlogPickSplit;
#define SizeOfSpgxlogPickSplit offsetof(spgxlogPickSplit, offsets)
typedef struct spgxlogVacuumLeaf
{
uint16 nDead; /* number of tuples to become DEAD */
uint16 nPlaceholder; /* number of tuples to become PLACEHOLDER */
uint16 nMove; /* number of tuples to move */
uint16 nChain; /* number of tuples to re-chain */
spgxlogState stateSrc;
/*----------
* data follows:
* tuple numbers to become DEAD
* tuple numbers to become PLACEHOLDER
* tuple numbers to move from (and replace with PLACEHOLDER)
* tuple numbers to move to (replacing what is there)
* tuple numbers to update nextOffset links of
* tuple numbers to insert in nextOffset links
*----------
*/
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} spgxlogVacuumLeaf;
#define SizeOfSpgxlogVacuumLeaf offsetof(spgxlogVacuumLeaf, offsets)
typedef struct spgxlogVacuumRoot
{
/* vacuum a root page when it is also a leaf */
uint16 nDelete; /* number of tuples to delete */
spgxlogState stateSrc;
/* offsets of tuples to delete follow */
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} spgxlogVacuumRoot;
#define SizeOfSpgxlogVacuumRoot offsetof(spgxlogVacuumRoot, offsets)
typedef struct spgxlogVacuumRedirect
{
uint16 nToPlaceholder; /* number of redirects to make placeholders */
OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */
TransactionId newestRedirectXid; /* newest XID of removed redirects */
/* offsets of redirect tuples to make placeholders follow */
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
} spgxlogVacuumRedirect;
#define SizeOfSpgxlogVacuumRedirect offsetof(spgxlogVacuumRedirect, offsets)
/*
* The "flags" argument for SpGistGetBuffer should be either GBUF_LEAF to
* get a leaf page, or GBUF_INNER_PARITY(blockNumber) to get an inner
* page in the same triple-parity group as the specified block number.
* (Typically, this should be GBUF_INNER_PARITY(parentBlockNumber + 1)
* to follow the rule described in spgist/README.)
* In addition, GBUF_NULLS can be OR'd in to get a page for storage of
* null-valued tuples.
*
* Note: these flag values are used as indexes into lastUsedPages.
*/
#define GBUF_LEAF 0x03
#define GBUF_INNER_PARITY(x) ((x) % 3)
#define GBUF_NULLS 0x04
#define GBUF_PARITY_MASK 0x03
#define GBUF_REQ_LEAF(flags) (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF)
#define GBUF_REQ_NULLS(flags) ((flags) & GBUF_NULLS)
/* spgutils.c */
extern SpGistCache *spgGetCache(Relation index);
extern void initSpGistState(SpGistState *state, Relation index);
extern Buffer SpGistNewBuffer(Relation index);
extern void SpGistUpdateMetaPage(Relation index);
extern Buffer SpGistGetBuffer(Relation index, int flags,
int needSpace, bool *isNew);
extern void SpGistSetLastUsedPage(Relation index, Buffer buffer);
extern void SpGistInitPage(Page page, uint16 f);
extern void SpGistInitBuffer(Buffer b, uint16 f);
extern void SpGistInitMetapage(Page page);
extern unsigned int SpGistGetTypeSize(SpGistTypeDesc *att, Datum datum);
extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state,
ItemPointer heapPtr,
Datum datum, bool isnull);
extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state,
Datum label, bool isnull);
extern SpGistInnerTuple spgFormInnerTuple(SpGistState *state,
bool hasPrefix, Datum prefix,
int nNodes, SpGistNodeTuple *nodes);
extern SpGistDeadTuple spgFormDeadTuple(SpGistState *state, int tupstate,
BlockNumber blkno, OffsetNumber offnum);
extern Datum *spgExtractNodeLabels(SpGistState *state,
SpGistInnerTuple innerTuple);
extern OffsetNumber SpGistPageAddNewItem(SpGistState *state, Page page,
Item item, Size size,
OffsetNumber *startOffset,
bool errorOK);
/* spgdoinsert.c */
extern void spgUpdateNodeLink(SpGistInnerTuple tup, int nodeN,
BlockNumber blkno, OffsetNumber offset);
extern void spgPageIndexMultiDelete(SpGistState *state, Page page,
OffsetNumber *itemnos, int nitems,
int firststate, int reststate,
BlockNumber blkno, OffsetNumber offnum);
extern bool spgdoinsert(Relation index, SpGistState *state,
ItemPointer heapPtr, Datum datum, bool isnull);
#endif /* SPGIST_PRIVATE_H */
# 652 "../../../../src/include/access/spgist_private.h"
# 20 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "access/xloginsert.h"
#endif /* expanded by -frewrite-includes */
# 20 "spgdoinsert.c"
# 1 "../../../../src/include/access/xloginsert.h" 1
/*
* xloginsert.h
*
* Functions for generating WAL records
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/xloginsert.h
*/
#ifndef XLOGINSERT_H
#define XLOGINSERT_H
#if 0 /* expanded by -frewrite-includes */
#include "access/rmgr.h"
#endif /* expanded by -frewrite-includes */
# 14 "../../../../src/include/access/xloginsert.h"
# 15 "../../../../src/include/access/xloginsert.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 15 "../../../../src/include/access/xloginsert.h"
# 16 "../../../../src/include/access/xloginsert.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/access/xloginsert.h"
# 17 "../../../../src/include/access/xloginsert.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/buf.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/xloginsert.h"
# 18 "../../../../src/include/access/xloginsert.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/relfilenode.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/xloginsert.h"
# 19 "../../../../src/include/access/xloginsert.h"
/*
* The minimum size of the WAL construction working area. If you need to
* register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more
* than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call
* XLogEnsureRecordSpace() first to allocate more working memory.
*/
#define XLR_NORMAL_MAX_BLOCK_ID 4
#define XLR_NORMAL_RDATAS 20
/* flags for XLogRegisterBuffer */
#define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */
#define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */
#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized
* at replay (implies
* NO_IMAGE) */
#define REGBUF_STANDARD 0x08/* page follows "standard" page layout, (data
* between pd_lower and pd_upper will be
* skipped) */
#define REGBUF_KEEP_DATA 0x10/* include data even if a full-page image is
* taken */
/* prototypes for public functions in xloginsert.c: */
extern void XLogBeginInsert(void);
extern void XLogIncludeOrigin(void);
extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
extern void XLogEnsureRecordSpace(int nbuffers, int ndatas);
extern void XLogRegisterData(char *data, int len);
extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);
extern void XLogRegisterBlock(uint8 block_id, RelFileNode *rnode,
ForkNumber forknum, BlockNumber blknum, char *page,
uint8 flags);
extern void XLogRegisterBufData(uint8 block_id, char *data, int len);
extern void XLogResetInsertion(void);
extern bool XLogCheckBufferNeedsBackup(Buffer buffer);
extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum,
BlockNumber blk, char *page, bool page_std);
extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
extern void InitXLogInsert(void);
#endif /* XLOGINSERT_H */
# 63 "../../../../src/include/access/xloginsert.h"
# 21 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "miscadmin.h"
#endif /* expanded by -frewrite-includes */
# 21 "spgdoinsert.c"
# 1 "../../../../src/include/miscadmin.h" 1
/*-------------------------------------------------------------------------
*
* miscadmin.h
* This file contains general postgres administration and initialization
* stuff that used to be spread out between the following files:
* globals.h global variables
* pdir.h directory path crud
* pinit.h postgres initialization
* pmod.h processing modes
* Over time, this has also become the preferred place for widely known
* resource-limitation stuff, such as work_mem and check_stack_depth().
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/miscadmin.h
*
* NOTES
* some of the information in this file should be moved to other files.
*
*-------------------------------------------------------------------------
*/
#ifndef MISCADMIN_H
#define MISCADMIN_H
#if 0 /* expanded by -frewrite-includes */
#include "pgtime.h" /* for pg_time_t */
#endif /* expanded by -frewrite-includes */
# 26 "../../../../src/include/miscadmin.h"
# 1 "../../../../src/include/pgtime.h" 1
/*-------------------------------------------------------------------------
*
* pgtime.h
* PostgreSQL internal timezone library
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
*
* IDENTIFICATION
* src/include/pgtime.h
*
*-------------------------------------------------------------------------
*/
#ifndef _PGTIME_H
#define _PGTIME_H
/*
* The API of this library is generally similar to the corresponding
* C library functions, except that we use pg_time_t which (we hope) is
* 64 bits wide, and which is most definitely signed not unsigned.
*/
typedef int64 pg_time_t;
struct pg_tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon; /* origin 0, not 1 */
int tm_year; /* relative to 1900 */
int tm_wday;
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
const char *tm_zone;
};
typedef struct pg_tz pg_tz;
typedef struct pg_tzenum pg_tzenum;
/* Maximum length of a timezone name (not including trailing null) */
#define TZ_STRLEN_MAX 255
/* these functions are in localtime.c */
extern struct pg_tm *pg_localtime(const pg_time_t *timep, const pg_tz *tz);
extern struct pg_tm *pg_gmtime(const pg_time_t *timep);
extern int pg_next_dst_boundary(const pg_time_t *timep,
long int *before_gmtoff,
int *before_isdst,
pg_time_t *boundary,
long int *after_gmtoff,
int *after_isdst,
const pg_tz *tz);
extern bool pg_interpret_timezone_abbrev(const char *abbrev,
const pg_time_t *timep,
long int *gmtoff,
int *isdst,
const pg_tz *tz);
extern bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff);
extern const char *pg_get_timezone_name(pg_tz *tz);
extern bool pg_tz_acceptable(pg_tz *tz);
/* these functions are in strftime.c */
extern size_t pg_strftime(char *s, size_t max, const char *format,
const struct pg_tm * tm);
/* these functions and variables are in pgtz.c */
extern pg_tz *session_timezone;
extern pg_tz *log_timezone;
extern void pg_timezone_initialize(void);
extern pg_tz *pg_tzset(const char *tzname);
extern pg_tz *pg_tzset_offset(long gmtoffset);
extern pg_tzenum *pg_tzenumerate_start(void);
extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir);
extern void pg_tzenumerate_end(pg_tzenum *dir);
#endif /* _PGTIME_H */
# 85 "../../../../src/include/pgtime.h"
# 27 "../../../../src/include/miscadmin.h" 2
#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
#define InvalidPid (-1)
/*****************************************************************************
* System interrupt and critical section handling
*
* There are two types of interrupts that a running backend needs to accept
* without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM).
* In both cases, we need to be able to clean up the current transaction
* gracefully, so we can't respond to the interrupt instantaneously ---
* there's no guarantee that internal data structures would be self-consistent
* if the code is interrupted at an arbitrary instant. Instead, the signal
* handlers set flags that are checked periodically during execution.
*
* The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots
* where it is normally safe to accept a cancel or die interrupt. In some
* cases, we invoke CHECK_FOR_INTERRUPTS() inside low-level subroutines that
* might sometimes be called in contexts that do *not* want to allow a cancel
* or die interrupt. The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros
* allow code to ensure that no cancel or die interrupt will be accepted,
* even if CHECK_FOR_INTERRUPTS() gets called in a subroutine. The interrupt
* will be held off until CHECK_FOR_INTERRUPTS() is done outside any
* HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section.
*
* There is also a mechanism to prevent query cancel interrupts, while still
* allowing die interrupts: HOLD_CANCEL_INTERRUPTS() and
* RESUME_CANCEL_INTERRUPTS().
*
* Special mechanisms are used to let an interrupt be accepted when we are
* waiting for a lock or when we are waiting for command input (but, of
* course, only if the interrupt holdoff counter is zero). See the
* related code for details.
*
* A lost connection is handled similarly, although the loss of connection
* does not raise a signal, but is detected when we fail to write to the
* socket. If there was a signal for a broken connection, we could make use of
* it by setting ClientConnectionLost in the signal handler.
*
* A related, but conceptually distinct, mechanism is the "critical section"
* mechanism. A critical section not only holds off cancel/die interrupts,
* but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC)
* --- that is, a system-wide reset is forced. Needless to say, only really
* *critical* code should be marked as a critical section! Currently, this
* mechanism is only used for XLOG-related code.
*
*****************************************************************************/
/* in globals.c */
/* these are marked volatile because they are set by signal handlers: */
extern PGDLLIMPORT volatile bool InterruptPending;
extern PGDLLIMPORT volatile bool QueryCancelPending;
extern PGDLLIMPORT volatile bool ProcDiePending;
extern PGDLLIMPORT volatile bool IdleInTransactionSessionTimeoutPending;
extern volatile bool ClientConnectionLost;
/* these are marked volatile because they are examined by signal handlers: */
extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount;
extern PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount;
extern PGDLLIMPORT volatile uint32 CritSectionCount;
/* in tcop/postgres.c */
extern void ProcessInterrupts(void);
#ifndef WIN32
#define CHECK_FOR_INTERRUPTS() \
do { \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
#else /* WIN32 */
# 103 "../../../../src/include/miscadmin.h"
#define CHECK_FOR_INTERRUPTS() \
do { \
if (UNBLOCKED_SIGNAL_QUEUE()) \
pgwin32_dispatch_queued_signals(); \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
#endif /* WIN32 */
# 112 "../../../../src/include/miscadmin.h"
#define HOLD_INTERRUPTS() (InterruptHoldoffCount++)
#define RESUME_INTERRUPTS() \
do { \
Assert(InterruptHoldoffCount > 0); \
InterruptHoldoffCount--; \
} while(0)
#define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++)
#define RESUME_CANCEL_INTERRUPTS() \
do { \
Assert(QueryCancelHoldoffCount > 0); \
QueryCancelHoldoffCount--; \
} while(0)
#define START_CRIT_SECTION() (CritSectionCount++)
#define END_CRIT_SECTION() \
do { \
Assert(CritSectionCount > 0); \
CritSectionCount--; \
} while(0)
/*****************************************************************************
* globals.h -- *
*****************************************************************************/
/*
* from utils/init/globals.c
*/
extern PGDLLIMPORT pid_t PostmasterPid;
extern bool IsPostmasterEnvironment;
extern PGDLLIMPORT bool IsUnderPostmaster;
extern bool IsBackgroundWorker;
extern PGDLLIMPORT bool IsBinaryUpgrade;
extern bool ExitOnAnyError;
extern PGDLLIMPORT char *DataDir;
extern PGDLLIMPORT int NBuffers;
extern int MaxBackends;
extern int MaxConnections;
extern int max_worker_processes;
extern PGDLLIMPORT int MyProcPid;
extern PGDLLIMPORT pg_time_t MyStartTime;
extern PGDLLIMPORT struct Port *MyProcPort;
extern PGDLLIMPORT struct Latch *MyLatch;
extern long MyCancelKey;
extern int MyPMChildSlot;
extern char OutputFileName[];
extern PGDLLIMPORT char my_exec_path[];
extern char pkglib_path[];
#ifdef EXEC_BACKEND
extern char postgres_exec_path[];
#endif
# 175 "../../../../src/include/miscadmin.h"
/*
* done in storage/backendid.h for now.
*
* extern BackendId MyBackendId;
*/
extern PGDLLIMPORT Oid MyDatabaseId;
extern PGDLLIMPORT Oid MyDatabaseTableSpace;
/*
* Date/Time Configuration
*
* DateStyle defines the output formatting choice for date/time types:
* USE_POSTGRES_DATES specifies traditional Postgres format
* USE_ISO_DATES specifies ISO-compliant format
* USE_SQL_DATES specifies Oracle/Ingres-compliant format
* USE_GERMAN_DATES specifies German-style dd.mm/yyyy
*
* DateOrder defines the field order to be assumed when reading an
* ambiguous date (anything not in YYYY-MM-DD format, with a four-digit
* year field first, is taken to be ambiguous):
* DATEORDER_YMD specifies field order yy-mm-dd
* DATEORDER_DMY specifies field order dd-mm-yy ("European" convention)
* DATEORDER_MDY specifies field order mm-dd-yy ("US" convention)
*
* In the Postgres and SQL DateStyles, DateOrder also selects output field
* order: day comes before month in DMY style, else month comes before day.
*
* The user-visible "DateStyle" run-time parameter subsumes both of these.
*/
/* valid DateStyle values */
#define USE_POSTGRES_DATES 0
#define USE_ISO_DATES 1
#define USE_SQL_DATES 2
#define USE_GERMAN_DATES 3
#define USE_XSD_DATES 4
/* valid DateOrder values */
#define DATEORDER_YMD 0
#define DATEORDER_DMY 1
#define DATEORDER_MDY 2
extern PGDLLIMPORT int DateStyle;
extern PGDLLIMPORT int DateOrder;
/*
* IntervalStyles
* INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso'
* INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso'
* INTSTYLE_SQL_STANDARD SQL standard interval literals
* INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals
*/
#define INTSTYLE_POSTGRES 0
#define INTSTYLE_POSTGRES_VERBOSE 1
#define INTSTYLE_SQL_STANDARD 2
#define INTSTYLE_ISO_8601 3
extern PGDLLIMPORT int IntervalStyle;
#define MAXTZLEN 10 /* max TZ name len, not counting tr. null */
extern bool enableFsync;
extern bool allowSystemTableMods;
extern PGDLLIMPORT int work_mem;
extern PGDLLIMPORT int maintenance_work_mem;
extern PGDLLIMPORT int replacement_sort_tuples;
extern int VacuumCostPageHit;
extern int VacuumCostPageMiss;
extern int VacuumCostPageDirty;
extern int VacuumCostLimit;
extern int VacuumCostDelay;
extern int VacuumPageHit;
extern int VacuumPageMiss;
extern int VacuumPageDirty;
extern int VacuumCostBalance;
extern bool VacuumCostActive;
/* in tcop/postgres.c */
#if defined(__ia64__) || defined(__ia64)
typedef struct
{
char *stack_base_ptr;
char *register_stack_base_ptr;
} pg_stack_base_t;
#else
# 267 "../../../../src/include/miscadmin.h"
typedef char *pg_stack_base_t;
#endif
# 269 "../../../../src/include/miscadmin.h"
extern pg_stack_base_t set_stack_base(void);
extern void restore_stack_base(pg_stack_base_t base);
extern void check_stack_depth(void);
extern bool stack_is_too_deep(void);
/* in tcop/utility.c */
extern void PreventCommandIfReadOnly(const char *cmdname);
extern void PreventCommandIfParallelMode(const char *cmdname);
extern void PreventCommandDuringRecovery(const char *cmdname);
/* in utils/misc/guc.c */
extern int trace_recovery_messages;
extern int trace_recovery(int trace_level);
/*****************************************************************************
* pdir.h -- *
* POSTGRES directory path definitions. *
*****************************************************************************/
/* flags to be OR'd to form sec_context */
#define SECURITY_LOCAL_USERID_CHANGE 0x0001
#define SECURITY_RESTRICTED_OPERATION 0x0002
#define SECURITY_NOFORCE_RLS 0x0004
extern char *DatabasePath;
/* now in utils/init/miscinit.c */
extern void InitPostmasterChild(void);
extern void InitStandaloneProcess(const char *argv0);
extern void SetDatabasePath(const char *path);
extern char *GetUserNameFromId(Oid roleid, bool noerr);
extern Oid GetUserId(void);
extern Oid GetOuterUserId(void);
extern Oid GetSessionUserId(void);
extern Oid GetAuthenticatedUserId(void);
extern void GetUserIdAndSecContext(Oid *userid, int *sec_context);
extern void SetUserIdAndSecContext(Oid userid, int sec_context);
extern bool InLocalUserIdChange(void);
extern bool InSecurityRestrictedOperation(void);
extern bool InNoForceRLSOperation(void);
extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
extern void InitializeSessionUserId(const char *rolename, Oid useroid);
extern void InitializeSessionUserIdStandalone(void);
extern void SetSessionAuthorization(Oid userid, bool is_superuser);
extern Oid GetCurrentRoleId(void);
extern void SetCurrentRoleId(Oid roleid, bool is_superuser);
extern void SetDataDir(const char *dir);
extern void ChangeToDataDir(void);
extern void SwitchToSharedLatch(void);
extern void SwitchBackToLocalLatch(void);
/* in utils/misc/superuser.c */
extern bool superuser(void); /* current user is superuser */
extern bool superuser_arg(Oid roleid); /* given user is superuser */
/*****************************************************************************
* pmod.h -- *
* POSTGRES processing mode definitions. *
*****************************************************************************/
/*
* Description:
* There are three processing modes in POSTGRES. They are
* BootstrapProcessing or "bootstrap," InitProcessing or
* "initialization," and NormalProcessing or "normal."
*
* The first two processing modes are used during special times. When the
* system state indicates bootstrap processing, transactions are all given
* transaction id "one" and are consequently guaranteed to commit. This mode
* is used during the initial generation of template databases.
*
* Initialization mode: used while starting a backend, until all normal
* initialization is complete. Some code behaves differently when executed
* in this mode to enable system bootstrapping.
*
* If a POSTGRES backend process is in normal mode, then all code may be
* executed normally.
*/
typedef enum ProcessingMode
{
BootstrapProcessing, /* bootstrap creation of template database */
InitProcessing, /* initializing system */
NormalProcessing /* normal processing */
} ProcessingMode;
extern ProcessingMode Mode;
#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
#define IsInitProcessingMode() (Mode == InitProcessing)
#define IsNormalProcessingMode() (Mode == NormalProcessing)
#define GetProcessingMode() Mode
#define SetProcessingMode(mode) \
do { \
AssertArg((mode) == BootstrapProcessing || \
(mode) == InitProcessing || \
(mode) == NormalProcessing); \
Mode = (mode); \
} while(0)
/*
* Auxiliary-process type identifiers. These used to be in bootstrap.h
* but it seems saner to have them here, with the ProcessingMode stuff.
* The MyAuxProcType global is defined and set in bootstrap.c.
*/
typedef enum
{
NotAnAuxProcess = -1,
CheckerProcess = 0,
BootstrapProcess,
StartupProcess,
BgWriterProcess,
CheckpointerProcess,
WalWriterProcess,
WalReceiverProcess,
NUM_AUXPROCTYPES /* Must be last! */
} AuxProcType;
extern AuxProcType MyAuxProcType;
#define AmBootstrapProcess() (MyAuxProcType == BootstrapProcess)
#define AmStartupProcess() (MyAuxProcType == StartupProcess)
#define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess)
#define AmCheckpointerProcess() (MyAuxProcType == CheckpointerProcess)
#define AmWalWriterProcess() (MyAuxProcType == WalWriterProcess)
#define AmWalReceiverProcess() (MyAuxProcType == WalReceiverProcess)
/*****************************************************************************
* pinit.h -- *
* POSTGRES initialization and cleanup definitions. *
*****************************************************************************/
/* in utils/init/postinit.c */
extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
extern void InitializeMaxBackends(void);
extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username,
Oid useroid, char *out_dbname);
extern void BaseInit(void);
/* in utils/init/miscinit.c */
extern bool IgnoreSystemIndexes;
extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress;
extern char *session_preload_libraries_string;
extern char *shared_preload_libraries_string;
extern char *local_preload_libraries_string;
/*
* As of 9.1, the contents of the data-directory lock file are:
*
* line #
* 1 postmaster PID (or negative of a standalone backend's PID)
* 2 data directory path
* 3 postmaster start timestamp (time_t representation)
* 4 port number
* 5 first Unix socket directory path (empty if none)
* 6 first listen_address (IP address or "*"; empty if no TCP port)
* 7 shared memory key (not present on Windows)
*
* Lines 6 and up are added via AddToDataDirLockFile() after initial file
* creation.
*
* The socket lock file, if used, has the same contents as lines 1-5.
*/
#define LOCK_FILE_LINE_PID 1
#define LOCK_FILE_LINE_DATA_DIR 2
#define LOCK_FILE_LINE_START_TIME 3
#define LOCK_FILE_LINE_PORT 4
#define LOCK_FILE_LINE_SOCKET_DIR 5
#define LOCK_FILE_LINE_LISTEN_ADDR 6
#define LOCK_FILE_LINE_SHMEM_KEY 7
extern void CreateDataDirLockFile(bool amPostmaster);
extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster,
const char *socketDir);
extern void TouchSocketLockFiles(void);
extern void AddToDataDirLockFile(int target_line, const char *str);
extern bool RecheckDataDirLockFile(void);
extern void ValidatePgVersion(const char *path);
extern void process_shared_preload_libraries(void);
extern void process_session_preload_libraries(void);
extern void pg_bindtextdomain(const char *domain);
extern bool has_rolreplication(Oid roleid);
/* in access/transam/xlog.c */
extern bool BackupInProgress(void);
extern void CancelBackup(void);
#endif /* MISCADMIN_H */
# 470 "../../../../src/include/miscadmin.h"
# 22 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/bufmgr.h"
#endif /* expanded by -frewrite-includes */
# 22 "spgdoinsert.c"
# 1 "../../../../src/include/storage/bufmgr.h" 1
/*-------------------------------------------------------------------------
*
* bufmgr.h
* POSTGRES buffer manager definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/bufmgr.h
*
*-------------------------------------------------------------------------
*/
#ifndef BUFMGR_H
#define BUFMGR_H
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/storage/bufmgr.h"
# 18 "../../../../src/include/storage/bufmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/buf.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/storage/bufmgr.h"
# 19 "../../../../src/include/storage/bufmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/bufpage.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/storage/bufmgr.h"
# 20 "../../../../src/include/storage/bufmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/relfilenode.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/storage/bufmgr.h"
# 21 "../../../../src/include/storage/bufmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/relcache.h"
#endif /* expanded by -frewrite-includes */
# 21 "../../../../src/include/storage/bufmgr.h"
# 22 "../../../../src/include/storage/bufmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/snapmgr.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/storage/bufmgr.h"
# 1 "../../../../src/include/utils/snapmgr.h" 1
/*-------------------------------------------------------------------------
*
* snapmgr.h
* POSTGRES snapshot manager
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/snapmgr.h
*
*-------------------------------------------------------------------------
*/
#ifndef SNAPMGR_H
#define SNAPMGR_H
#if 0 /* expanded by -frewrite-includes */
#include "fmgr.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/utils/snapmgr.h"
# 17 "../../../../src/include/utils/snapmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/relcache.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/utils/snapmgr.h"
# 18 "../../../../src/include/utils/snapmgr.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/resowner.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/utils/snapmgr.h"
# 1 "../../../../src/include/utils/resowner.h" 1
/*-------------------------------------------------------------------------
*
* resowner.h
* POSTGRES resource owner definitions.
*
* Query-lifespan resources are tracked by associating them with
* ResourceOwner objects. This provides a simple mechanism for ensuring
* that such resources are freed at the right time.
* See utils/resowner/README for more info.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/resowner.h
*
*-------------------------------------------------------------------------
*/
#ifndef RESOWNER_H
#define RESOWNER_H
/*
* ResourceOwner objects are an opaque data structure known only within
* resowner.c.
*/
typedef struct ResourceOwnerData *ResourceOwner;
/*
* Globally known ResourceOwners
*/
extern PGDLLIMPORT ResourceOwner CurrentResourceOwner;
extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner;
extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner;
/*
* Resource releasing is done in three phases: pre-locks, locks, and
* post-locks. The pre-lock phase must release any resources that are
* visible to other backends (such as pinned buffers); this ensures that
* when we release a lock that another backend may be waiting on, it will
* see us as being fully out of our transaction. The post-lock phase
* should be used for backend-internal cleanup.
*/
typedef enum
{
RESOURCE_RELEASE_BEFORE_LOCKS,
RESOURCE_RELEASE_LOCKS,
RESOURCE_RELEASE_AFTER_LOCKS
} ResourceReleasePhase;
/*
* Dynamically loaded modules can get control during ResourceOwnerRelease
* by providing a callback of this form.
*/
typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase,
bool isCommit,
bool isTopLevel,
void *arg);
/*
* Functions in resowner.c
*/
/* generic routines */
extern ResourceOwner ResourceOwnerCreate(ResourceOwner parent,
const char *name);
extern void ResourceOwnerRelease(ResourceOwner owner,
ResourceReleasePhase phase,
bool isCommit,
bool isTopLevel);
extern void ResourceOwnerDelete(ResourceOwner owner);
extern ResourceOwner ResourceOwnerGetParent(ResourceOwner owner);
extern void ResourceOwnerNewParent(ResourceOwner owner,
ResourceOwner newparent);
extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback,
void *arg);
extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback,
void *arg);
#endif /* RESOWNER_H */
# 83 "../../../../src/include/utils/resowner.h"
# 19 "../../../../src/include/utils/snapmgr.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/snapshot.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/utils/snapmgr.h"
# 20 "../../../../src/include/utils/snapmgr.h"
/*
* The structure used to map times to TransactionId values for the "snapshot
* too old" feature must have a few entries at the tail to hold old values;
* otherwise the lookup will often fail and the expected early pruning or
* vacuum will not usually occur. It is best if this padding is for a number
* of minutes greater than a thread would normally be stalled, but it's OK if
* early vacuum opportunities are occasionally missed, so there's no need to
* use an extreme value or get too fancy. 10 minutes seems plenty.
*/
#define OLD_SNAPSHOT_PADDING_ENTRIES 10
#define OLD_SNAPSHOT_TIME_MAP_ENTRIES (old_snapshot_threshold + OLD_SNAPSHOT_PADDING_ENTRIES)
/*
* Common definition of relation properties that allow early pruning/vacuuming
* when old_snapshot_threshold >= 0.
*/
#define RelationAllowsEarlyPruning(rel) \
( \
RelationNeedsWAL(rel) \
&& !IsCatalogRelation(rel) \
&& !RelationIsAccessibleInLogicalDecoding(rel) \
&& !RelationHasUnloggedIndex(rel) \
)
#define EarlyPruningEnabled(rel) (old_snapshot_threshold >= 0 && RelationAllowsEarlyPruning(rel))
/* GUC variables */
extern PGDLLIMPORT int old_snapshot_threshold;
extern Size SnapMgrShmemSize(void);
extern void SnapMgrInit(void);
extern int64 GetSnapshotCurrentTimestamp(void);
extern int64 GetOldSnapshotThresholdTimestamp(void);
extern bool FirstSnapshotSet;
extern TransactionId TransactionXmin;
extern TransactionId RecentXmin;
extern TransactionId RecentGlobalXmin;
extern TransactionId RecentGlobalDataXmin;
extern Snapshot GetTransactionSnapshot(void);
extern Snapshot GetLatestSnapshot(void);
extern void SnapshotSetCommandId(CommandId curcid);
extern Snapshot GetOldestSnapshot(void);
extern Snapshot GetCatalogSnapshot(Oid relid);
extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid);
extern void InvalidateCatalogSnapshot(void);
extern void InvalidateCatalogSnapshotConditionally(void);
extern void PushActiveSnapshot(Snapshot snapshot);
extern void PushCopiedSnapshot(Snapshot snapshot);
extern void UpdateActiveSnapshotCommandId(void);
extern void PopActiveSnapshot(void);
extern Snapshot GetActiveSnapshot(void);
extern bool ActiveSnapshotSet(void);
extern Snapshot RegisterSnapshot(Snapshot snapshot);
extern void UnregisterSnapshot(Snapshot snapshot);
extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner);
extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner);
extern void AtSubCommit_Snapshot(int level);
extern void AtSubAbort_Snapshot(int level);
extern void AtEOXact_Snapshot(bool isCommit);
extern Datum pg_export_snapshot(PG_FUNCTION_ARGS);
extern void ImportSnapshot(const char *idstr);
extern bool XactHasExportedSnapshots(void);
extern void DeleteAllExportedSnapshotFiles(void);
extern bool ThereAreNoPriorRegisteredSnapshots(void);
extern TransactionId TransactionIdLimitedForOldSnapshots(TransactionId recentXmin,
Relation relation);
extern void MaintainOldSnapshotTimeMapping(int64 whenTaken, TransactionId xmin);
extern char *ExportSnapshot(Snapshot snapshot);
/* Support for catalog timetravel for logical decoding */
struct HTAB;
extern struct HTAB *HistoricSnapshotGetTupleCids(void);
extern void SetupHistoricSnapshot(Snapshot snapshot_now, struct HTAB *tuplecids);
extern void TeardownHistoricSnapshot(bool is_error);
extern bool HistoricSnapshotActive(void);
extern Size EstimateSnapshotSpace(Snapshot snapshot);
extern void SerializeSnapshot(Snapshot snapshot, char *start_address);
extern Snapshot RestoreSnapshot(char *start_address);
extern void RestoreTransactionSnapshot(Snapshot snapshot, void *master_pgproc);
#endif /* SNAPMGR_H */
# 114 "../../../../src/include/utils/snapmgr.h"
# 23 "../../../../src/include/storage/bufmgr.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/tqual.h"
#endif /* expanded by -frewrite-includes */
# 23 "../../../../src/include/storage/bufmgr.h"
# 1 "../../../../src/include/utils/tqual.h" 1
/*-------------------------------------------------------------------------
*
* tqual.h
* POSTGRES "time qualification" definitions, ie, tuple visibility rules.
*
* Should be moved/renamed... - vadim 07/28/98
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/tqual.h
*
*-------------------------------------------------------------------------
*/
#ifndef TQUAL_H
#define TQUAL_H
#if 0 /* expanded by -frewrite-includes */
#include "utils/snapshot.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/utils/tqual.h"
# 19 "../../../../src/include/utils/tqual.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/utils/tqual.h"
# 20 "../../../../src/include/utils/tqual.h"
/* Static variables representing various special snapshot semantics */
extern PGDLLIMPORT SnapshotData SnapshotSelfData;
extern PGDLLIMPORT SnapshotData SnapshotAnyData;
extern PGDLLIMPORT SnapshotData CatalogSnapshotData;
#define SnapshotSelf (&SnapshotSelfData)
#define SnapshotAny (&SnapshotAnyData)
/* This macro encodes the knowledge of which snapshots are MVCC-safe */
#define IsMVCCSnapshot(snapshot) \
((snapshot)->satisfies == HeapTupleSatisfiesMVCC || \
(snapshot)->satisfies == HeapTupleSatisfiesHistoricMVCC)
/*
* HeapTupleSatisfiesVisibility
* True iff heap tuple satisfies a time qual.
*
* Notes:
* Assumes heap tuple is valid.
* Beware of multiple evaluations of snapshot argument.
* Hint bits in the HeapTuple's t_infomask may be updated as a side effect;
* if so, the indicated buffer is marked dirty.
*/
#define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer) \
((*(snapshot)->satisfies) (tuple, snapshot, buffer))
/* Result codes for HeapTupleSatisfiesVacuum */
typedef enum
{
HEAPTUPLE_DEAD, /* tuple is dead and deletable */
HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
} HTSV_Result;
/* These are the "satisfies" test routines for the various snapshot types */
extern bool HeapTupleSatisfiesMVCC(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesSelf(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesAny(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesToast(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesDirty(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesHistoricMVCC(HeapTuple htup,
Snapshot snapshot, Buffer buffer);
/* Special "satisfies" routines with different APIs */
extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTuple htup,
CommandId curcid, Buffer buffer);
extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup,
TransactionId OldestXmin, Buffer buffer);
extern bool HeapTupleIsSurelyDead(HeapTuple htup,
TransactionId OldestXmin);
extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
uint16 infomask, TransactionId xid);
extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple);
/*
* To avoid leaking too much knowledge about reorderbuffer implementation
* details this is implemented in reorderbuffer.c not tqual.c.
*/
struct HTAB;
extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data,
Snapshot snapshot,
HeapTuple htup,
Buffer buffer,
CommandId *cmin, CommandId *cmax);
/*
* We don't provide a static SnapshotDirty variable because it would be
* non-reentrant. Instead, users of that snapshot type should declare a
* local variable of type SnapshotData, and initialize it with this macro.
*/
#define InitDirtySnapshot(snapshotdata) \
((snapshotdata).satisfies = HeapTupleSatisfiesDirty)
/*
* Similarly, some initialization is required for SnapshotToast. We need
* to set lsn and whenTaken correctly to support snapshot_too_old.
*/
#define InitToastSnapshot(snapshotdata, l, w) \
((snapshotdata).satisfies = HeapTupleSatisfiesToast, \
(snapshotdata).lsn = (l), \
(snapshotdata).whenTaken = (w))
#endif /* TQUAL_H */
# 113 "../../../../src/include/utils/tqual.h"
# 24 "../../../../src/include/storage/bufmgr.h" 2
typedef void *Block;
/* Possible arguments for GetAccessStrategy() */
typedef enum BufferAccessStrategyType
{
BAS_NORMAL, /* Normal random access */
BAS_BULKREAD, /* Large read-only scan (hint bit updates are
* ok) */
BAS_BULKWRITE, /* Large multi-block write (e.g. COPY IN) */
BAS_VACUUM /* VACUUM */
} BufferAccessStrategyType;
/* Possible modes for ReadBufferExtended() */
typedef enum
{
RBM_NORMAL, /* Normal read */
RBM_ZERO_AND_LOCK, /* Don't read from disk, caller will
* initialize. Also locks the page. */
RBM_ZERO_AND_CLEANUP_LOCK, /* Like RBM_ZERO_AND_LOCK, but locks the page
* in "cleanup" mode */
RBM_ZERO_ON_ERROR, /* Read, but return an all-zeros page on error */
RBM_NORMAL_NO_LOG /* Don't log page as invalid during WAL
* replay; otherwise same as RBM_NORMAL */
} ReadBufferMode;
/* forward declared, to avoid having to expose buf_internals.h here */
struct WritebackContext;
/* in globals.c ... this duplicates miscadmin.h */
extern PGDLLIMPORT int NBuffers;
/* in bufmgr.c */
extern bool zero_damaged_pages;
extern int bgwriter_lru_maxpages;
extern double bgwriter_lru_multiplier;
extern bool track_io_timing;
extern int target_prefetch_pages;
extern int checkpoint_flush_after;
extern int backend_flush_after;
extern int bgwriter_flush_after;
/* in buf_init.c */
extern PGDLLIMPORT char *BufferBlocks;
/* in guc.c */
extern int effective_io_concurrency;
/* in localbuf.c */
extern PGDLLIMPORT int NLocBuffer;
extern PGDLLIMPORT Block *LocalBufferBlockPointers;
extern PGDLLIMPORT int32 *LocalRefCount;
/* upper limit for effective_io_concurrency */
#define MAX_IO_CONCURRENCY 1000
/* special block number for ReadBuffer() */
#define P_NEW InvalidBlockNumber /* grow the file to get a new page */
/*
* Buffer content lock modes (mode argument for LockBuffer())
*/
#define BUFFER_LOCK_UNLOCK 0
#define BUFFER_LOCK_SHARE 1
#define BUFFER_LOCK_EXCLUSIVE 2
/*
* These routines are beaten on quite heavily, hence the macroization.
*/
/*
* BufferIsValid
* True iff the given buffer number is valid (either as a shared
* or local buffer).
*
* Note: For a long time this was defined the same as BufferIsPinned,
* that is it would say False if you didn't hold a pin on the buffer.
* I believe this was bogus and served only to mask logic errors.
* Code should always know whether it has a buffer reference,
* independently of the pin state.
*
* Note: For a further long time this was not quite the inverse of the
* BufferIsInvalid() macro, in that it also did sanity checks to verify
* that the buffer number was in range. Most likely, this macro was
* originally intended only to be used in assertions, but its use has
* since expanded quite a bit, and the overhead of making those checks
* even in non-assert-enabled builds can be significant. Thus, we've
* now demoted the range checks to assertions within the macro itself.
*/
#define BufferIsValid(bufnum) \
( \
AssertMacro((bufnum) <= NBuffers && (bufnum) >= -NLocBuffer), \
(bufnum) != InvalidBuffer \
)
/*
* BufferGetBlock
* Returns a reference to a disk page image associated with a buffer.
*
* Note:
* Assumes buffer is valid.
*/
#define BufferGetBlock(buffer) \
( \
AssertMacro(BufferIsValid(buffer)), \
BufferIsLocal(buffer) ? \
LocalBufferBlockPointers[-(buffer) - 1] \
: \
(Block) (BufferBlocks + ((Size) ((buffer) - 1)) * BLCKSZ) \
)
/*
* BufferGetPageSize
* Returns the page size within a buffer.
*
* Notes:
* Assumes buffer is valid.
*
* The buffer can be a raw disk block and need not contain a valid
* (formatted) disk page.
*/
/* XXX should dig out of buffer descriptor */
#define BufferGetPageSize(buffer) \
( \
AssertMacro(BufferIsValid(buffer)), \
(Size)BLCKSZ \
)
/*
* BufferGetPage
* Returns the page associated with a buffer.
*
* When this is called as part of a scan, there may be a need for a nearby
* call to TestForOldSnapshot(). See the definition of that for details.
*/
#define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer))
/*
* prototypes for functions in bufmgr.c
*/
extern bool ComputeIoConcurrency(int io_concurrency, double *target);
extern void PrefetchBuffer(Relation reln, ForkNumber forkNum,
BlockNumber blockNum);
extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum,
BlockNumber blockNum, ReadBufferMode mode,
BufferAccessStrategy strategy);
extern Buffer ReadBufferWithoutRelcache(RelFileNode rnode,
ForkNumber forkNum, BlockNumber blockNum,
ReadBufferMode mode, BufferAccessStrategy strategy);
extern void ReleaseBuffer(Buffer buffer);
extern void UnlockReleaseBuffer(Buffer buffer);
extern void MarkBufferDirty(Buffer buffer);
extern void IncrBufferRefCount(Buffer buffer);
extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
BlockNumber blockNum);
extern void InitBufferPool(void);
extern void InitBufferPoolAccess(void);
extern void InitBufferPoolBackend(void);
extern void AtEOXact_Buffers(bool isCommit);
extern void PrintBufferLeakWarning(Buffer buffer);
extern void CheckPointBuffers(int flags);
extern BlockNumber BufferGetBlockNumber(Buffer buffer);
extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation,
ForkNumber forkNum);
extern void FlushOneBuffer(Buffer buffer);
extern void FlushRelationBuffers(Relation rel);
extern void FlushDatabaseBuffers(Oid dbid);
extern void DropRelFileNodeBuffers(RelFileNodeBackend rnode,
ForkNumber forkNum, BlockNumber firstDelBlock);
extern void DropRelFileNodesAllBuffers(RelFileNodeBackend *rnodes, int nnodes);
extern void DropDatabaseBuffers(Oid dbid);
#define RelationGetNumberOfBlocks(reln) \
RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM)
extern bool BufferIsPermanent(Buffer buffer);
extern XLogRecPtr BufferGetLSNAtomic(Buffer buffer);
#ifdef NOT_USED
extern void PrintPinnedBufs(void);
#endif
# 208 "../../../../src/include/storage/bufmgr.h"
extern Size BufferShmemSize(void);
extern void BufferGetTag(Buffer buffer, RelFileNode *rnode,
ForkNumber *forknum, BlockNumber *blknum);
extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std);
extern void UnlockBuffers(void);
extern void LockBuffer(Buffer buffer, int mode);
extern bool ConditionalLockBuffer(Buffer buffer);
extern void LockBufferForCleanup(Buffer buffer);
extern bool ConditionalLockBufferForCleanup(Buffer buffer);
extern bool HoldingBufferPinThatDelaysRecovery(void);
extern void AbortBufferIO(void);
extern void BufmgrCommit(void);
extern bool BgBufferSync(struct WritebackContext *wb_context);
extern void AtProcExit_LocalBuffers(void);
extern void TestForOldSnapshot_impl(Snapshot snapshot, Relation relation);
/* in freelist.c */
extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype);
extern void FreeAccessStrategy(BufferAccessStrategy strategy);
/* inline functions */
/*
* Although this header file is nominally backend-only, certain frontend
* programs like pg_xlogdump include it. For compilers that emit static
* inline functions even when they're unused, that leads to unsatisfied
* external references; hence hide these with #ifndef FRONTEND.
*/
#ifndef FRONTEND
/*
* Check whether the given snapshot is too old to have safely read the given
* page from the given table. If so, throw a "snapshot too old" error.
*
* This test generally needs to be performed after every BufferGetPage() call
* that is executed as part of a scan. It is not needed for calls made for
* modifying the page (for example, to position to the right place to insert a
* new index tuple or for vacuuming). It may also be omitted where calls to
* lower-level functions will have already performed the test.
*
* Note that a NULL snapshot argument is allowed and causes a fast return
* without error; this is to support call sites which can be called from
* either scans or index modification areas.
*
* For best performance, keep the tests that are fastest and/or most likely to
* exclude a page from old snapshot testing near the front.
*/
static inline void
TestForOldSnapshot(Snapshot snapshot, Relation relation, Page page)
{
Assert(relation != NULL);
if (old_snapshot_threshold >= 0
&& (snapshot) != NULL
&& ((snapshot)->satisfies == HeapTupleSatisfiesMVCC
|| (snapshot)->satisfies == HeapTupleSatisfiesToast)
&& !XLogRecPtrIsInvalid((snapshot)->lsn)
&& PageGetLSN(page) > (snapshot)->lsn)
TestForOldSnapshot_impl(snapshot, relation);
}
#endif /* FRONTEND */
# 278 "../../../../src/include/storage/bufmgr.h"
#endif /* BUFMGR_H */
# 280 "../../../../src/include/storage/bufmgr.h"
# 23 "spgdoinsert.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "utils/rel.h"
#endif /* expanded by -frewrite-includes */
# 23 "spgdoinsert.c"
# 1 "../../../../src/include/utils/rel.h" 1
/*-------------------------------------------------------------------------
*
* rel.h
* POSTGRES relation descriptor (a/k/a relcache entry) definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/rel.h
*
*-------------------------------------------------------------------------
*/
#ifndef REL_H
#define REL_H
#if 0 /* expanded by -frewrite-includes */
#include "access/tupdesc.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/utils/rel.h"
# 18 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xlog.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/utils/rel.h"
# 1 "../../../../src/include/access/xlog.h" 1
/*
* xlog.h
*
* PostgreSQL transaction log manager
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/xlog.h
*/
#ifndef XLOG_H
#define XLOG_H
#if 0 /* expanded by -frewrite-includes */
#include "access/rmgr.h"
#endif /* expanded by -frewrite-includes */
# 14 "../../../../src/include/access/xlog.h"
# 15 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogdefs.h"
#endif /* expanded by -frewrite-includes */
# 15 "../../../../src/include/access/xlog.h"
# 16 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xloginsert.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/access/xlog.h"
# 17 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "access/xlogreader.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/access/xlog.h"
# 18 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "datatype/timestamp.h"
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/access/xlog.h"
# 1 "../../../../src/include/datatype/timestamp.h" 1
/*-------------------------------------------------------------------------
*
* timestamp.h
* Timestamp and Interval typedefs and related macros.
*
* Note: this file must be includable in both frontend and backend contexts.
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/datatype/timestamp.h
*
*-------------------------------------------------------------------------
*/
#ifndef DATATYPE_TIMESTAMP_H
#define DATATYPE_TIMESTAMP_H
#if 0 /* expanded by -frewrite-includes */
#include <math.h>
#endif /* expanded by -frewrite-includes */
# 18 "../../../../src/include/datatype/timestamp.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 1 3 4
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef _MATH_H_
#define _MATH_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 20 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
# 21 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 21 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
# 22 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>
#endif /* expanded by -frewrite-includes */
# 22 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
* from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp
* $FreeBSD$
*/
#ifndef _MACHINE__LIMITS_H_
#define _MACHINE__LIMITS_H_
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
*/
#define __CHAR_BIT 8 /* number of bits in a char */
#define __SCHAR_MAX 0x7f /* max value for a signed char */
#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */
#define __UCHAR_MAX 0xff /* max value for an unsigned char */
#define __USHRT_MAX 0xffff /* max value for an unsigned short */
#define __SHRT_MAX 0x7fff /* max value for a short */
#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */
#define __UINT_MAX 0xffffffff /* max value for an unsigned int */
#define __INT_MAX 0x7fffffff /* max value for an int */
#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */
#ifdef __mips_n64
#define __ULONG_MAX 0xffffffffffffffff
#define __LONG_MAX 0x7fffffffffffffff
#define __LONG_MIN (-0x7fffffffffffffff - 1)
#define __LONG_BIT 64
#else
# 67 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
#define __LONG_MAX 0x7fffffffL /* max value for a long */
#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */
#define __LONG_BIT 32
#endif
# 72 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
/* max value for an unsigned long long */
#define __ULLONG_MAX 0xffffffffffffffffULL
#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */
#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */
#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */
#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */
#define __OFF_MAX __LLONG_MAX /* max value for an off_t */
#define __OFF_MIN __LLONG_MIN /* min value for an off_t */
/* Quads and long longs are the same size. Ensure they stay in sync. */
#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */
#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */
#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */
#define __WORD_BIT 32
#define __MINSIGSTKSZ (512 * 4)
#endif /* !_MACHINE__LIMITS_H_ */
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
# 23 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 2 3 4
/*
* ANSI/POSIX
*/
extern const union __infinity_un {
unsigned char __uc[8];
double __ud;
} __infinity;
extern const union __nan_un {
unsigned char __uc[sizeof(float)];
float __uf;
} __nan;
#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __MATH_BUILTIN_CONSTANTS
#endif
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
#define __MATH_BUILTIN_RELOPS
#endif
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VAL __builtin_huge_val()
#else
# 48 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE_VAL (__infinity.__ud)
#endif
# 50 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __ISO_C_VISIBLE >= 1999
#define FP_ILOGB0 (-__INT_MAX)
#define FP_ILOGBNAN __INT_MAX
#ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VALF __builtin_huge_valf()
#define HUGE_VALL __builtin_huge_vall()
#define INFINITY __builtin_inff()
#define NAN __builtin_nanf("")
#else
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE_VALF (float)HUGE_VAL
#define HUGE_VALL (long double)HUGE_VAL
#define INFINITY HUGE_VALF
#define NAN (__nan.__uf)
#endif /* __MATH_BUILTIN_CONSTANTS */
# 66 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
#define math_errhandling MATH_ERREXCEPT
#define FP_FAST_FMAF 1
/* Symbolic constants to classify floating point numbers. */
#define FP_INFINITE 0x01
#define FP_NAN 0x02
#define FP_NORMAL 0x04
#define FP_SUBNORMAL 0x08
#define FP_ZERO 0x10
#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
__has_extension(c_generic_selections)
#define __fp_type_select(x, f, d, ld) _Generic((x), \
float: f(x), \
double: d(x), \
long double: ld(x), \
volatile float: f(x), \
volatile double: d(x), \
volatile long double: ld(x), \
volatile const float: f(x), \
volatile const double: d(x), \
volatile const long double: ld(x), \
const float: f(x), \
const double: d(x), \
const long double: ld(x))
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
# 96 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), long double), ld(x), \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), double), d(x), \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
#else
# 103 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define __fp_type_select(x, f, d, ld) \
((sizeof(x) == sizeof(float)) ? f(x) \
: (sizeof(x) == sizeof(double)) ? d(x) \
: ld(x))
#endif
# 108 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define fpclassify(x) \
__fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
#define isnan(x) \
__fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
#ifdef __MATH_BUILTIN_RELOPS
#define isgreater(x, y) __builtin_isgreater((x), (y))
#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
#define isless(x, y) __builtin_isless((x), (y))
#define islessequal(x, y) __builtin_islessequal((x), (y))
#define islessgreater(x, y) __builtin_islessgreater((x), (y))
#define isunordered(x, y) __builtin_isunordered((x), (y))
#else
# 125 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
#define islessgreater(x, y) (!isunordered((x), (y)) && \
((x) > (y) || (y) > (x)))
#define isunordered(x, y) (isnan(x) || isnan(y))
#endif /* __MATH_BUILTIN_RELOPS */
# 133 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
typedef __double_t double_t;
typedef __float_t float_t;
#endif /* __ISO_C_VISIBLE >= 1999 */
# 139 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/*
* XOPEN/SVID
*/
#if __BSD_VISIBLE || __XSI_VISIBLE
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#define MAXFLOAT ((float)3.40282346638528860e+38)
extern int signgam;
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
# 161 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE
#if 0
/* Old value from 4.4BSD-Lite math.h; this is probably better. */
#define HUGE HUGE_VAL
#else
# 167 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE MAXFLOAT
#endif
# 169 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#endif /* __BSD_VISIBLE */
# 170 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/*
* Most of these functions depend on the rounding mode and have the side
* effect of raising floating-point exceptions, so they are not declared
* as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
*/
__BEGIN_DECLS
/*
* ANSI/POSIX
*/
int __fpclassifyd(double) __pure2;
int __fpclassifyf(float) __pure2;
int __fpclassifyl(long double) __pure2;
int __isfinitef(float) __pure2;
int __isfinite(double) __pure2;
int __isfinitel(long double) __pure2;
int __isinff(float) __pure2;
int __isinf(double) __pure2;
int __isinfl(long double) __pure2;
int __isnormalf(float) __pure2;
int __isnormal(double) __pure2;
int __isnormall(long double) __pure2;
int __signbit(double) __pure2;
int __signbitf(float) __pure2;
int __signbitl(long double) __pure2;
static __inline int
__inline_isnan(__const double __x)
{
return (__x != __x);
}
static __inline int
__inline_isnanf(__const float __x)
{
return (__x != __x);
}
static __inline int
__inline_isnanl(__const long double __x)
{
return (__x != __x);
}
/*
* Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
* isinf() as functions taking double. C99, and the subsequent POSIX revisions
* (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
* point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
* expose the newer definition, assuming that the language spec takes
* precedence over the operating system interface spec.
*/
#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
#undef isinf
#undef isnan
int isinf(double);
int isnan(double);
#endif
# 231 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double cosh(double);
double sinh(double);
double tanh(double);
double exp(double);
double frexp(double, int *); /* fundamentally !__pure2 */
double ldexp(double, int);
double log(double);
double log10(double);
double modf(double, double *); /* fundamentally !__pure2 */
double pow(double, double);
double sqrt(double);
double ceil(double);
double fabs(double) __pure2;
double floor(double);
double fmod(double, double);
/*
* These functions are not in C90.
*/
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
double acosh(double);
double asinh(double);
double atanh(double);
double cbrt(double);
double erf(double);
double erfc(double);
double exp2(double);
double expm1(double);
double fma(double, double, double);
double hypot(double, double);
int ilogb(double) __pure2;
double lgamma(double);
long long llrint(double);
long long llround(double);
double log1p(double);
double log2(double);
double logb(double);
long lrint(double);
long lround(double);
double nan(const char *) __pure2;
double nextafter(double, double);
double remainder(double, double);
double remquo(double, double, int *);
double rint(double);
#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
# 288 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE || __XSI_VISIBLE
double j0(double);
double j1(double);
double jn(int, double);
double y0(double);
double y1(double);
double yn(int, double);
#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
double gamma(double);
#endif
# 300 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
double scalb(double, double);
#endif
# 304 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
# 305 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
double copysign(double, double) __pure2;
double fdim(double, double);
double fmax(double, double) __pure2;
double fmin(double, double) __pure2;
double nearbyint(double);
double round(double);
double scalbln(double, long);
double scalbn(double, int);
double tgamma(double);
double trunc(double);
#endif
# 318 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/*
* BSD math library entry points
*/
#if __BSD_VISIBLE
double drem(double, double);
int finite(double) __pure2;
int isnanf(float) __pure2;
/*
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
double gamma_r(double, int *);
double lgamma_r(double, int *);
/*
* IEEE Test Vector
*/
double significand(double);
#endif /* __BSD_VISIBLE */
# 339 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/* float versions of ANSI/POSIX functions */
#if __ISO_C_VISIBLE >= 1999
float acosf(float);
float asinf(float);
float atanf(float);
float atan2f(float, float);
float cosf(float);
float sinf(float);
float tanf(float);
float coshf(float);
float sinhf(float);
float tanhf(float);
float exp2f(float);
float expf(float);
float expm1f(float);
float frexpf(float, int *); /* fundamentally !__pure2 */
int ilogbf(float) __pure2;
float ldexpf(float, int);
float log10f(float);
float log1pf(float);
float log2f(float);
float logf(float);
float modff(float, float *); /* fundamentally !__pure2 */
float powf(float, float);
float sqrtf(float);
float ceilf(float);
float fabsf(float) __pure2;
float floorf(float);
float fmodf(float, float);
float roundf(float);
float erff(float);
float erfcf(float);
float hypotf(float, float);
float lgammaf(float);
float tgammaf(float);
float acoshf(float);
float asinhf(float);
float atanhf(float);
float cbrtf(float);
float logbf(float);
float copysignf(float, float) __pure2;
long long llrintf(float);
long long llroundf(float);
long lrintf(float);
long lroundf(float);
float nanf(const char *) __pure2;
float nearbyintf(float);
float nextafterf(float, float);
float remainderf(float, float);
float remquof(float, float, int *);
float rintf(float);
float scalblnf(float, long);
float scalbnf(float, int);
float truncf(float);
float fdimf(float, float);
float fmaf(float, float, float);
float fmaxf(float, float) __pure2;
float fminf(float, float) __pure2;
#endif
# 406 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/*
* float versions of BSD math library entry points
*/
#if __BSD_VISIBLE
float dremf(float, float);
int finitef(float) __pure2;
float gammaf(float);
float j0f(float);
float j1f(float);
float jnf(int, float);
float scalbf(float, float);
float y0f(float);
float y1f(float);
float ynf(int, float);
/*
* Float versions of reentrant version of gamma & lgamma; passes
* signgam back by reference as the second argument; user must
* allocate space for signgam.
*/
float gammaf_r(float, int *);
float lgammaf_r(float, int *);
/*
* float version of IEEE Test Vector
*/
float significandf(float);
#endif /* __BSD_VISIBLE */
# 435 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
/*
* long double versions of ISO/POSIX math functions
*/
#if __ISO_C_VISIBLE >= 1999
long double acoshl(long double);
long double acosl(long double);
long double asinhl(long double);
long double asinl(long double);
long double atan2l(long double, long double);
long double atanhl(long double);
long double atanl(long double);
long double cbrtl(long double);
long double ceill(long double);
long double copysignl(long double, long double) __pure2;
long double coshl(long double);
long double cosl(long double);
long double erfcl(long double);
long double erfl(long double);
long double exp2l(long double);
long double expl(long double);
long double expm1l(long double);
long double fabsl(long double) __pure2;
long double fdiml(long double, long double);
long double floorl(long double);
long double fmal(long double, long double, long double);
long double fmaxl(long double, long double) __pure2;
long double fminl(long double, long double) __pure2;
long double fmodl(long double, long double);
long double frexpl(long double, int *); /* fundamentally !__pure2 */
long double hypotl(long double, long double);
int ilogbl(long double) __pure2;
long double ldexpl(long double, int);
long double lgammal(long double);
long long llrintl(long double);
long long llroundl(long double);
long double log10l(long double);
long double log1pl(long double);
long double log2l(long double);
long double logbl(long double);
long double logl(long double);
long lrintl(long double);
long lroundl(long double);
long double modfl(long double, long double *); /* fundamentally !__pure2 */
long double nanl(const char *) __pure2;
long double nearbyintl(long double);
long double nextafterl(long double, long double);
double nexttoward(double, long double);
float nexttowardf(float, long double);
long double nexttowardl(long double, long double);
long double powl(long double, long double);
long double remainderl(long double, long double);
long double remquol(long double, long double, int *);
long double rintl(long double);
long double roundl(long double);
long double scalblnl(long double, long);
long double scalbnl(long double, int);
long double sinhl(long double);
long double sinl(long double);
long double sqrtl(long double);
long double tanhl(long double);
long double tanl(long double);
long double tgammal(long double);
long double truncl(long double);
#endif /* __ISO_C_VISIBLE >= 1999 */
# 500 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE
long double lgammal_r(long double, int *);
#endif
# 504 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
__END_DECLS
#endif /* !_MATH_H_ */
# 508 "/home/en322/cheri/output/sdk256/sysroot/usr/include/math.h" 3 4
# 19 "../../../../src/include/datatype/timestamp.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <limits.h>
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/datatype/timestamp.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.2 (Berkeley) 1/4/94
* $FreeBSD$
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE
#define _POSIX_ARG_MAX 4096
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#if __POSIX_VISIBLE >= 200112
#define _POSIX_CHILD_MAX 25
#define _POSIX_NGROUPS_MAX 8
#define _POSIX_OPEN_MAX 20
#define _POSIX_PATH_MAX 256
#define _POSIX_TZNAME_MAX 6
#else
# 55 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#define _POSIX_CHILD_MAX 6
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_TZNAME_MAX 3
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
#define BC_SCALE_MAX 99 /* max scale value in bc(1) */
#define BC_STRING_MAX 1000 /* max const string length in bc(1) */
#define CHARCLASS_NAME_MAX 14 /* max character class name size */
#define COLL_WEIGHTS_MAX 10 /* max weights for order keyword */
#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
#define LINE_MAX 2048 /* max bytes in an input line */
#define RE_DUP_MAX 255 /* max RE's in interval notation */
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_CHARCLASS_NAME_MAX 14
#define _POSIX2_COLL_WEIGHTS_MAX 2
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
#endif
# 84 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#endif
# 85 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 199309
#define _POSIX_AIO_LISTIO_MAX 2
#define _POSIX_AIO_MAX 1
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_MQ_OPEN_MAX 8
#define _POSIX_MQ_PRIO_MAX 32
#define _POSIX_RTSIG_MAX 8
#define _POSIX_SEM_NSEMS_MAX 256
#define _POSIX_SEM_VALUE_MAX 32767
#define _POSIX_SIGQUEUE_MAX 32
#define _POSIX_TIMER_MAX 32
#define _POSIX_CLOCKRES_MIN 20000000
#endif
# 100 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 199506
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define _POSIX_THREAD_KEYS_MAX 128
#define _POSIX_THREAD_THREADS_MAX 64
#endif
# 106 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define _POSIX_HOST_NAME_MAX 255
#define _POSIX_LOGIN_NAME_MAX 9
#define _POSIX_SS_REPL_MAX 4
#define _POSIX_SYMLINK_MAX 255
#define _POSIX_SYMLOOP_MAX 8
#define _POSIX_TRACE_EVENT_NAME_MAX 30
#define _POSIX_TRACE_NAME_MAX 8
#define _POSIX_TRACE_SYS_MAX 8
#define _POSIX_TRACE_USER_EVENT_MAX 32
#define _POSIX_TTY_NAME_MAX 9
#define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX
#endif
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define NL_ARGMAX 65536 /* max # of position args for printf */
#define NL_MSGMAX 32767
#define NL_SETMAX 255
#define NL_TEXTMAX 2048
#endif
# 128 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#if __XSI_VISIBLE
#define _XOPEN_IOV_MAX 16
#define _XOPEN_NAME_MAX 255
#define _XOPEN_PATH_MAX 1024
#define PASS_MAX 128 /* _PASSWORD_LEN from <pwd.h> */
#define NL_LANGMAX 31 /* max LANG name length */
#define NL_NMAX 1
#endif
# 138 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#define MB_LEN_MAX 6 /* 31-bit UTF-8 */
#if 0 /* expanded by -frewrite-includes */
#include <sys/limits.h>
#endif /* expanded by -frewrite-includes */
# 141 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_LIMITS_H_
#define _SYS_LIMITS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 35 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define CHAR_BIT __CHAR_BIT /* number of bits in a char */
#define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */
#define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */
#define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */
#ifdef __CHAR_UNSIGNED__
#define CHAR_MAX UCHAR_MAX /* max value for a char */
#define CHAR_MIN 0 /* min value for a char */
#else
# 49 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN
#endif
# 52 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */
#define SHRT_MAX __SHRT_MAX /* max value for a short */
#define SHRT_MIN __SHRT_MIN /* min value for a short */
#define UINT_MAX __UINT_MAX /* max value for an unsigned int */
#define INT_MAX __INT_MAX /* max value for an int */
#define INT_MIN __INT_MIN /* min value for an int */
#define ULONG_MAX __ULONG_MAX /* max for an unsigned long */
#define LONG_MAX __LONG_MAX /* max for a long */
#define LONG_MIN __LONG_MIN /* min for a long */
#ifdef __LONG_LONG_SUPPORTED
#define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */
#define LLONG_MAX __LLONG_MAX /* max for a long long */
#define LLONG_MIN __LLONG_MIN /* min for a long long */
#endif
# 70 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */
#endif
# 74 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */
#define OFF_MAX __OFF_MAX /* max value for an off_t */
#define OFF_MIN __OFF_MIN /* min value for an off_t */
#endif
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __BSD_VISIBLE
#define GID_MAX UINT_MAX /* max value for a gid_t */
#define UID_MAX UINT_MAX /* max value for a uid_t */
#define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */
#define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */
#define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */
#endif
# 90 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define LONG_BIT __LONG_BIT
#define WORD_BIT __WORD_BIT
#endif
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE
#define MQ_PRIO_MAX 64
#endif
# 99 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#endif /* !_SYS_LIMITS_H_ */
# 101 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 142 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 2 3 4
#if __POSIX_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/syslimits.h>
#endif /* expanded by -frewrite-includes */
# 144 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)syslimits.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _SYS_SYSLIMITS_H_
#define _SYS_SYSLIMITS_H_
#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#ifdef __CC_SUPPORTS_WARNING
#warning "No user-serviceable parts inside."
#endif
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#endif
# 44 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
/*
* Do not add any new variables here. (See the comment at the end of
* the file for why.)
*/
#define ARG_MAX 262144 /* max bytes for an exec function */
#ifndef CHILD_MAX
#define CHILD_MAX 40 /* max simultaneous processes */
#endif
# 53 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#define LINK_MAX 32767 /* max file link count */
#define MAX_CANON 255 /* max bytes in term canon input line */
#define MAX_INPUT 255 /* max bytes in terminal input */
#define NAME_MAX 255 /* max bytes in a file name */
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 1023 /* max supplemental group id's */
#endif
# 60 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#ifndef OPEN_MAX
#define OPEN_MAX 64 /* max open files per process */
#endif
# 63 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#define PATH_MAX 1024 /* max bytes in pathname */
#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
#define IOV_MAX 1024 /* max elements in i/o vector */
/*
* We leave the following values undefined to force applications to either
* assume conservative values or call sysconf() to get the current value.
*
* HOST_NAME_MAX
*
* (We should do this for most of the values currently defined here,
* but many programs are not prepared to deal with this yet.)
*/
#endif
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
# 145 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 2 3 4
#endif
# 146 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
#endif /* !_LIMITS_H_ */
# 148 "/home/en322/cheri/output/sdk256/sysroot/usr/include/limits.h" 3 4
# 20 "../../../../src/include/datatype/timestamp.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <float.h>
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/datatype/timestamp.h"
# 1 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 1 3 4
/*===---- float.h - Characteristics of floating point types ----------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __FLOAT_H
#define __FLOAT_H
/* If we're on MinGW, fall back to the system's float.h, which might have
* additional definitions provided for Windows.
* For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
*
* Also fall back on Darwin to allow additional definitions and
* implementation-defined values.
*/
#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
__STDC_HOSTED__ && (1)/*__has_include_next(<float.h>)*/
#if 0 /* expanded by -frewrite-includes */
# include_next <float.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
# 37 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
/* Undefine anything that we'll be redefining below. */
# undef FLT_EVAL_METHOD
# undef FLT_ROUNDS
# undef FLT_RADIX
# undef FLT_MANT_DIG
# undef DBL_MANT_DIG
# undef LDBL_MANT_DIG
# if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
# undef DECIMAL_DIG
# endif
# 48 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
# undef FLT_DIG
# undef DBL_DIG
# undef LDBL_DIG
# undef FLT_MIN_EXP
# undef DBL_MIN_EXP
# undef LDBL_MIN_EXP
# undef FLT_MIN_10_EXP
# undef DBL_MIN_10_EXP
# undef LDBL_MIN_10_EXP
# undef FLT_MAX_EXP
# undef DBL_MAX_EXP
# undef LDBL_MAX_EXP
# undef FLT_MAX_10_EXP
# undef DBL_MAX_10_EXP
# undef LDBL_MAX_10_EXP
# undef FLT_MAX
# undef DBL_MAX
# undef LDBL_MAX
# undef FLT_EPSILON
# undef DBL_EPSILON
# undef LDBL_EPSILON
# undef FLT_MIN
# undef DBL_MIN
# undef LDBL_MIN
# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
# undef FLT_TRUE_MIN
# undef DBL_TRUE_MIN
# undef LDBL_TRUE_MIN
# undef FLT_DECIMAL_DIG
# undef DBL_DECIMAL_DIG
# undef LDBL_DECIMAL_DIG
# endif
# 80 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
#endif
# 81 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
/* Characteristics of floating point types, C99 5.2.4.2.2 */
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#define FLT_ROUNDS (__builtin_flt_rounds())
#define FLT_RADIX __FLT_RADIX__
#define FLT_MANT_DIG __FLT_MANT_DIG__
#define DBL_MANT_DIG __DBL_MANT_DIG__
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
# define DECIMAL_DIG __DECIMAL_DIG__
#endif
# 95 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
#define FLT_DIG __FLT_DIG__
#define DBL_DIG __DBL_DIG__
#define LDBL_DIG __LDBL_DIG__
#define FLT_MIN_EXP __FLT_MIN_EXP__
#define DBL_MIN_EXP __DBL_MIN_EXP__
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
#define FLT_MAX_EXP __FLT_MAX_EXP__
#define DBL_MAX_EXP __DBL_MAX_EXP__
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
#define FLT_MAX __FLT_MAX__
#define DBL_MAX __DBL_MAX__
#define LDBL_MAX __LDBL_MAX__
#define FLT_EPSILON __FLT_EPSILON__
#define DBL_EPSILON __DBL_EPSILON__
#define LDBL_EPSILON __LDBL_EPSILON__
#define FLT_MIN __FLT_MIN__
#define DBL_MIN __DBL_MIN__
#define LDBL_MIN __LDBL_MIN__
#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
# define FLT_TRUE_MIN __FLT_DENORM_MIN__
# define DBL_TRUE_MIN __DBL_DENORM_MIN__
# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#endif
# 136 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
#endif /* __FLOAT_H */
# 138 "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0/include/float.h" 3 4
# 21 "../../../../src/include/datatype/timestamp.h" 2
/*
* Timestamp represents absolute time.
*
* Interval represents delta time. Keep track of months (and years), days,
* and hours/minutes/seconds separately since the elapsed time spanned is
* unknown until instantiated relative to an absolute time.
*
* Note that Postgres uses "time interval" to mean a bounded interval,
* consisting of a beginning and ending time, not a time span - thomas 97/03/20
*
* We have two implementations, one that uses int64 values with units of
* microseconds, and one that uses double values with units of seconds.
*
* TimeOffset and fsec_t are convenience typedefs for temporary variables
* that are of different types in the two cases. Do not use fsec_t in values
* stored on-disk, since it is not the same size in both implementations.
* Also, fsec_t is only meant for *fractional* seconds; beware of overflow
* if the value you need to store could be many seconds.
*/
#ifdef HAVE_INT64_TIMESTAMP
typedef int64 Timestamp;
typedef int64 TimestampTz;
typedef int64 TimeOffset;
typedef int32 fsec_t; /* fractional seconds (in microseconds) */
#else
# 49 "../../../../src/include/datatype/timestamp.h"
typedef double Timestamp;
typedef double TimestampTz;
typedef double TimeOffset;
typedef double fsec_t; /* fractional seconds (in seconds) */
#endif
# 55 "../../../../src/include/datatype/timestamp.h"
typedef struct
{
TimeOffset time; /* all time units other than days, months and
* years */
int32 day; /* days, after time for alignment */
int32 month; /* months and years, after time for alignment */
} Interval;
#define MAX_TIMESTAMP_PRECISION 6
#define MAX_INTERVAL_PRECISION 6
/*
* Round off to MAX_TIMESTAMP_PRECISION decimal places.
* Note: this is also used for rounding off intervals.
*/
#define TS_PREC_INV 1000000.0
#define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)
/*
* Assorted constants for datetime-related calculations
*/
#define DAYS_PER_YEAR 365.25 /* assumes leap year every four years */
#define MONTHS_PER_YEAR 12
/*
* DAYS_PER_MONTH is very imprecise. The more accurate value is
* 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only
* return an integral number of days, but someday perhaps we should
* also return a 'time' value to be used as well. ISO 8601 suggests
* 30 days.
*/
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
#define HOURS_PER_DAY 24 /* assume no daylight savings time changes */
/*
* This doesn't adjust for uneven daylight savings time intervals or leap
* seconds, and it crudely estimates leap years. A more accurate value
* for days per years is 365.2422.
*/
#define SECS_PER_YEAR (36525 * 864) /* avoid floating-point computation */
#define SECS_PER_DAY 86400
#define SECS_PER_HOUR 3600
#define SECS_PER_MINUTE 60
#define MINS_PER_HOUR 60
#define USECS_PER_DAY INT64CONST(86400000000)
#define USECS_PER_HOUR INT64CONST(3600000000)
#define USECS_PER_MINUTE INT64CONST(60000000)
#define USECS_PER_SEC INT64CONST(1000000)
/*
* We allow numeric timezone offsets up to 15:59:59 either way from Greenwich.
* Currently, the record holders for wackiest offsets in actual use are zones
* Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42
* until 1867. If we were to reject such values we would fail to dump and
* restore old timestamptz values with these zone settings.
*/
#define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */
#define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)
/*
* DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity
*/
#ifdef HAVE_INT64_TIMESTAMP
#define DT_NOBEGIN PG_INT64_MIN
#define DT_NOEND PG_INT64_MAX
#else /* !HAVE_INT64_TIMESTAMP */
# 125 "../../../../src/include/datatype/timestamp.h"
#ifdef HUGE_VAL
#define DT_NOBEGIN (-HUGE_VAL)
#define DT_NOEND (HUGE_VAL)
#else
# 129 "../../../../src/include/datatype/timestamp.h"
#define DT_NOBEGIN (-DBL_MAX)
#define DT_NOEND (DBL_MAX)
#endif
# 132 "../../../../src/include/datatype/timestamp.h"
#endif /* HAVE_INT64_TIMESTAMP */
# 133 "../../../../src/include/datatype/timestamp.h"
#define TIMESTAMP_NOBEGIN(j) \
do {(j) = DT_NOBEGIN;} while (0)
#define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN)
#define TIMESTAMP_NOEND(j) \
do {(j) = DT_NOEND;} while (0)
#define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND)
#define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j))
/*
* Julian date support.
*
* date2j() and j2date() nominally handle the Julian date range 0..INT_MAX,
* or 4714-11-24 BC to 5874898-06-03 AD. In practice, date2j() will work and
* give correct negative Julian dates for dates before 4714-11-24 BC as well.
* We rely on it to do so back to 4714-11-01 BC. Allowing at least one day's
* slop is necessary so that timestamp rotation doesn't produce dates that
* would be rejected on input. For example, '4714-11-24 00:00 GMT BC' is a
* legal timestamptz value, but in zones east of Greenwich it would print as
* sometime in the afternoon of 4714-11-23 BC; if we couldn't process such a
* date we'd have a dump/reload failure. So the idea is for IS_VALID_JULIAN
* to accept a slightly wider range of dates than we really support, and
* then we apply the exact checks in IS_VALID_DATE or IS_VALID_TIMESTAMP,
* after timezone rotation if any. To save a few cycles, we can make
* IS_VALID_JULIAN check only to the month boundary, since its exact cutoffs
* are not very critical in this scheme.
*
* It is correct that JULIAN_MINYEAR is -4713, not -4714; it is defined to
* allow easy comparison to tm_year values, in which we follow the convention
* that tm_year <= 0 represents abs(tm_year)+1 BC.
*/
#define JULIAN_MINYEAR (-4713)
#define JULIAN_MINMONTH (11)
#define JULIAN_MINDAY (24)
#define JULIAN_MAXYEAR (5874898)
#define JULIAN_MAXMONTH (6)
#define JULIAN_MAXDAY (3)
#define IS_VALID_JULIAN(y,m,d) \
(((y) > JULIAN_MINYEAR || \
((y) == JULIAN_MINYEAR && ((m) >= JULIAN_MINMONTH))) && \
((y) < JULIAN_MAXYEAR || \
((y) == JULIAN_MAXYEAR && ((m) < JULIAN_MAXMONTH))))
/* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */
#define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */
#define POSTGRES_EPOCH_JDATE 2451545 /* == date2j(2000, 1, 1) */
/*
* Range limits for dates and timestamps.
*
* We have traditionally allowed Julian day zero as a valid datetime value,
* so that is the lower bound for both dates and timestamps.
*
* The upper limit for dates is 5874897-12-31, which is a bit less than what
* the Julian-date code can allow. We use that same limit for timestamps when
* using floating-point timestamps (so that the timezone offset problem would
* exist here too if there were no slop). For integer timestamps, the upper
* limit is 294276-12-31. The int64 overflow limit would be a few days later;
* again, leaving some slop avoids worries about corner-case overflow, and
* provides a simpler user-visible definition.
*/
/* First allowed date, and first disallowed date, in Julian-date form */
#define DATETIME_MIN_JULIAN (0)
#define DATE_END_JULIAN (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */
#ifdef HAVE_INT64_TIMESTAMP
#define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */
#else
# 208 "../../../../src/include/datatype/timestamp.h"
#define TIMESTAMP_END_JULIAN DATE_END_JULIAN
#endif
# 210 "../../../../src/include/datatype/timestamp.h"
/* Timestamp limits */
#ifdef HAVE_INT64_TIMESTAMP
#define MIN_TIMESTAMP INT64CONST(-211813488000000000)
/* == (DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */
#define END_TIMESTAMP INT64CONST(9223371331200000000)
/* == (TIMESTAMP_END_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */
#else
# 218 "../../../../src/include/datatype/timestamp.h"
#define MIN_TIMESTAMP (-211813488000.0)
/* == (DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) * SECS_PER_DAY */
#define END_TIMESTAMP 185330760393600.0
/* == (TIMESTAMP_END_JULIAN - POSTGRES_EPOCH_JDATE) * SECS_PER_DAY */
#endif
# 223 "../../../../src/include/datatype/timestamp.h"
/* Range-check a date (given in Postgres, not Julian, numbering) */
#define IS_VALID_DATE(d) \
((DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) <= (d) && \
(d) < (DATE_END_JULIAN - POSTGRES_EPOCH_JDATE))
/* Range-check a timestamp */
#define IS_VALID_TIMESTAMP(t) (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP)
#endif /* DATATYPE_TIMESTAMP_H */
# 233 "../../../../src/include/datatype/timestamp.h"
# 19 "../../../../src/include/access/xlog.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "lib/stringinfo.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/access/xlog.h"
# 20 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "nodes/pg_list.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/access/xlog.h"
# 21 "../../../../src/include/access/xlog.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/fd.h"
#endif /* expanded by -frewrite-includes */
# 21 "../../../../src/include/access/xlog.h"
# 1 "../../../../src/include/storage/fd.h" 1
/*-------------------------------------------------------------------------
*
* fd.h
* Virtual file descriptor definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/fd.h
*
*-------------------------------------------------------------------------
*/
/*
* calls:
*
* File {Close, Read, Write, Seek, Tell, Sync}
* {Path Name Open, Allocate, Free} File
*
* These are NOT JUST RENAMINGS OF THE UNIX ROUTINES.
* Use them for all file activity...
*
* File fd;
* fd = PathNameOpenFile("foo", O_RDONLY, 0600);
*
* AllocateFile();
* FreeFile();
*
* Use AllocateFile, not fopen, if you need a stdio file (FILE*); then
* use FreeFile, not fclose, to close it. AVOID using stdio for files
* that you intend to hold open for any length of time, since there is
* no way for them to share kernel file descriptors with other files.
*
* Likewise, use AllocateDir/FreeDir, not opendir/closedir, to allocate
* open directories (DIR*), and OpenTransientFile/CloseTransient File for an
* unbuffered file descriptor.
*/
#ifndef FD_H
#define FD_H
#if 0 /* expanded by -frewrite-includes */
#include <dirent.h>
#endif /* expanded by -frewrite-includes */
# 42 "../../../../src/include/storage/fd.h"
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 1 3 4
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
* $FreeBSD$
*/
#ifndef _DIRENT_H_
#define _DIRENT_H_
/*
* The kernel defines the format of directory entries returned by
* the getdirentries(2) system call.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 40 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 41 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/dirent.h>
#endif /* expanded by -frewrite-includes */
# 42 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
# 1 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 1 3 4
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dirent.h 8.3 (Berkeley) 8/10/94
* $FreeBSD$
*/
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 37 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
# 38 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
/*
* The dirent structure defines the format of directory entries returned by
* the getdirentries(2) system call.
*
* A directory entry has a struct dirent at the front of it, containing its
* inode number, the length of the entry, and the length of the name
* contained in the entry. These are followed by the name padded to a 4
* byte boundary with null bytes. All names are guaranteed null terminated.
* The maximum length of a name in a directory is MAXNAMLEN.
*/
struct dirent {
__uint32_t d_fileno; /* file number of entry */
__uint16_t d_reclen; /* length of this record */
__uint8_t d_type; /* file type, see below */
__uint8_t d_namlen; /* length of string in d_name */
#if __BSD_VISIBLE
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
#else
# 59 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
char d_name[255 + 1]; /* name must be no longer than this */
#endif
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
};
#if __BSD_VISIBLE
/*
* File types
*/
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
/*
* Convert between stat structure types and directory types.
*/
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
/*
* The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This returns the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*
* XXX although this macro is in the implementation namespace, it requires
* a manifest constant that is not.
*/
#define _GENERIC_DIRSIZ(dp) \
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
#endif /* __BSD_VISIBLE */
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
#ifdef _KERNEL
#define GENERIC_DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
#endif
# 99 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
#endif /* !_SYS_DIRENT_H_ */
# 101 "/home/en322/cheri/output/sdk256/sysroot/usr/include/sys/dirent.h" 3 4
# 43 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 2 3 4
#if __XSI_VISIBLE
#ifndef _INO_T_DECLARED
typedef __ino_t ino_t;
#define _INO_T_DECLARED
#endif
# 50 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
/*
* XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer
* to the specification.
*/
#define d_ino d_fileno /* backward and XSI compatibility */
#endif /* __XSI_VISIBLE */
# 58 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 61 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
# 62 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
struct _dirdesc;
typedef struct _dirdesc DIR;
/* flags for opendir2 */
#define DTF_HIDEW 0x0001 /* hide whiteout entries */
#define DTF_NODUP 0x0002 /* don't return duplicate names */
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
#define __DTF_READALL 0x0008 /* everything has been read */
#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */
#else /* !__BSD_VISIBLE */
# 77 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
typedef void * DIR;
#endif /* __BSD_VISIBLE */
# 81 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#ifndef _KERNEL
__BEGIN_DECLS
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
int alphasort(const struct dirent **, const struct dirent **);
int dirfd(DIR *);
#endif
# 89 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#if __BSD_VISIBLE
DIR *__opendir2(const char *, int);
int fdclosedir(DIR *);
int getdents(int, char *, int);
int getdirentries(int, char *, int, long *);
#endif
# 95 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
DIR *opendir(const char *);
DIR *fdopendir(int);
struct dirent *
readdir(DIR *);
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
int readdir_r(DIR *, struct dirent *, struct dirent **);
#endif
# 102 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
void rewinddir(DIR *);
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
int scandir(const char *, struct dirent ***,
int (*)(const struct dirent *), int (*)(const struct dirent **,
const struct dirent **));
#ifdef __BLOCKS__
int scandir_b(const char *, struct dirent ***,
int (^)(const struct dirent *),
int (^)(const struct dirent **, const struct dirent **));
#endif
# 112 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#endif
# 113 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#if __XSI_VISIBLE
void seekdir(DIR *, long);
long telldir(DIR *);
#endif
# 117 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
int closedir(DIR *);
__END_DECLS
#endif /* !_KERNEL */
# 121 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
#endif /* !_DIRENT_H_ */
# 123 "/home/en322/cheri/output/sdk256/sysroot/usr/include/dirent.h" 3 4
# 43 "../../../../src/include/storage/fd.h" 2
/*
* FileSeek uses the standard UNIX lseek(2) flags.
*/
typedef char *FileName;
typedef int File;
/* GUC parameter */
extern int max_files_per_process;
/*
* This is private to fd.c, but exported for save/restore_backend_variables()
*/
extern int max_safe_fds;
/*
* prototypes for functions in fd.c
*/
/* Operations on virtual Files --- equivalent to Unix kernel file ops */
extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
extern File OpenTemporaryFile(bool interXact);
extern void FileClose(File file);
extern int FilePrefetch(File file, off_t offset, int amount);
extern int FileRead(File file, char *buffer, int amount);
extern int FileWrite(File file, char *buffer, int amount);
extern int FileSync(File file);
extern off_t FileSeek(File file, off_t offset, int whence);
extern int FileTruncate(File file, off_t offset);
extern void FileWriteback(File file, off_t offset, off_t nbytes);
extern char *FilePathName(File file);
extern int FileGetRawDesc(File file);
extern int FileGetRawFlags(File file);
extern int FileGetRawMode(File file);
/* Operations that allow use of regular stdio --- USE WITH CAUTION */
extern FILE *AllocateFile(const char *name, const char *mode);
extern int FreeFile(FILE *file);
/* Operations that allow use of pipe streams (popen/pclose) */
extern FILE *OpenPipeStream(const char *command, const char *mode);
extern int ClosePipeStream(FILE *file);
/* Operations to allow use of the <dirent.h> library routines */
extern DIR *AllocateDir(const char *dirname);
extern struct dirent *ReadDir(DIR *dir, const char *dirname);
extern int FreeDir(DIR *dir);
/* Operations to allow use of a plain kernel FD, with automatic cleanup */
extern int OpenTransientFile(FileName fileName, int fileFlags, int fileMode);
extern int CloseTransientFile(int fd);
/* If you've really really gotta have a plain kernel FD, use this */
extern int BasicOpenFile(FileName fileName, int fileFlags, int fileMode);
/* Miscellaneous support routines */
extern void InitFileAccess(void);
extern void set_max_safe_fds(void);
extern void closeAllVfds(void);
extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces);
extern bool TempTablespacesAreSet(void);
extern Oid GetNextTempTableSpace(void);
extern void AtEOXact_Files(void);
extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid,
SubTransactionId parentSubid);
extern void RemovePgTempFiles(void);
extern int pg_fsync(int fd);
extern int pg_fsync_no_writethrough(int fd);
extern int pg_fsync_writethrough(int fd);
extern int pg_fdatasync(int fd);
extern void pg_flush_data(int fd, off_t offset, off_t amount);
extern void fsync_fname(const char *fname, bool isdir);
extern int durable_rename(const char *oldfile, const char *newfile, int loglevel);
extern int durable_link_or_rename(const char *oldfile, const char *newfile, int loglevel);
extern void SyncDataDirectory(void);
/* Filename components for OpenTemporaryFile */
#define PG_TEMP_FILES_DIR "pgsql_tmp"
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
#endif /* FD_H */
# 130 "../../../../src/include/storage/fd.h"
# 22 "../../../../src/include/access/xlog.h" 2
/* Sync methods */
#define SYNC_METHOD_FSYNC 0
#define SYNC_METHOD_FDATASYNC 1
#define SYNC_METHOD_OPEN 2 /* for O_SYNC */
#define SYNC_METHOD_FSYNC_WRITETHROUGH 3
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
extern int sync_method;
extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */
/*
* Prior to 8.4, all activity during recovery was carried out by the startup
* process. This local variable continues to be used in many parts of the
* code to indicate actions taken by RecoveryManagers. Other processes that
* potentially perform work during recovery should check RecoveryInProgress().
* See XLogCtl notes in xlog.c.
*/
extern bool InRecovery;
/*
* Like InRecovery, standbyState is only valid in the startup process.
* In all other processes it will have the value STANDBY_DISABLED (so
* InHotStandby will read as FALSE).
*
* In DISABLED state, we're performing crash recovery or hot standby was
* disabled in postgresql.conf.
*
* In INITIALIZED state, we've run InitRecoveryTransactionEnvironment, but
* we haven't yet processed a RUNNING_XACTS or shutdown-checkpoint WAL record
* to initialize our master-transaction tracking system.
*
* When the transaction tracking is initialized, we enter the SNAPSHOT_PENDING
* state. The tracked information might still be incomplete, so we can't allow
* connections yet, but redo functions must update the in-memory state when
* appropriate.
*
* In SNAPSHOT_READY mode, we have full knowledge of transactions that are
* (or were) running in the master at the current WAL location. Snapshots
* can be taken, and read-only queries can be run.
*/
typedef enum
{
STANDBY_DISABLED,
STANDBY_INITIALIZED,
STANDBY_SNAPSHOT_PENDING,
STANDBY_SNAPSHOT_READY
} HotStandbyState;
extern HotStandbyState standbyState;
#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING)
/*
* Recovery target type.
* Only set during a Point in Time recovery, not when standby_mode = on
*/
typedef enum
{
RECOVERY_TARGET_UNSET,
RECOVERY_TARGET_XID,
RECOVERY_TARGET_TIME,
RECOVERY_TARGET_NAME,
RECOVERY_TARGET_IMMEDIATE
} RecoveryTargetType;
extern XLogRecPtr ProcLastRecPtr;
extern XLogRecPtr XactLastRecEnd;
extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
extern bool reachedConsistency;
/* these variables are GUC parameters related to XLOG */
extern int min_wal_size;
extern int max_wal_size;
extern int wal_keep_segments;
extern int XLOGbuffers;
extern int XLogArchiveTimeout;
extern int wal_retrieve_retry_interval;
extern char *XLogArchiveCommand;
extern bool EnableHotStandby;
extern bool fullPageWrites;
extern bool wal_log_hints;
extern bool wal_compression;
extern bool log_checkpoints;
extern int CheckPointSegments;
/* Archive modes */
typedef enum ArchiveMode
{
ARCHIVE_MODE_OFF = 0, /* disabled */
ARCHIVE_MODE_ON, /* enabled while server is running normally */
ARCHIVE_MODE_ALWAYS /* enabled always (even during recovery) */
} ArchiveMode;
extern int XLogArchiveMode;
/* WAL levels */
typedef enum WalLevel
{
WAL_LEVEL_MINIMAL = 0,
WAL_LEVEL_REPLICA,
WAL_LEVEL_LOGICAL
} WalLevel;
extern PGDLLIMPORT int wal_level;
/* Is WAL archiving enabled (always or only while server is running normally)? */
#define XLogArchivingActive() \
(AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode > ARCHIVE_MODE_OFF)
/* Is WAL archiving enabled always (even during recovery)? */
#define XLogArchivingAlways() \
(AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode == ARCHIVE_MODE_ALWAYS)
#define XLogArchiveCommandSet() (XLogArchiveCommand[0] != '\0')
/*
* Is WAL-logging necessary for archival or log-shipping, or can we skip
* WAL-logging if we fsync() the data before committing instead?
*/
#define XLogIsNeeded() (wal_level >= WAL_LEVEL_REPLICA)
/*
* Is a full-page image needed for hint bit updates?
*
* Normally, we don't WAL-log hint bit updates, but if checksums are enabled,
* we have to protect them against torn page writes. When you only set
* individual bits on a page, it's still consistent no matter what combination
* of the bits make it to disk, but the checksum wouldn't match. Also WAL-log
* them if forced by wal_log_hints=on.
*/
#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints)
/* Do we need to WAL-log information required only for Hot Standby and logical replication? */
#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_REPLICA)
/* Do we need to WAL-log information required only for logical replication? */
#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL)
#ifdef WAL_DEBUG
extern bool XLOG_DEBUG;
#endif
# 164 "../../../../src/include/access/xlog.h"
/*
* OR-able request flag bits for checkpoints. The "cause" bits are used only
* for logging purposes. Note: the flags must be defined so that it's
* sensible to OR together request flags arising from different requestors.
*/
/* These directly affect the behavior of CreateCheckPoint and subsidiaries */
#define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */
#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint,
* but issued at end of WAL
* recovery */
#define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */
#define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */
#define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those
* belonging to unlogged tables */
/* These are important to RequestCheckpoint */
#define CHECKPOINT_WAIT 0x0020 /* Wait for completion */
/* These indicate the cause of a checkpoint request */
#define CHECKPOINT_CAUSE_XLOG 0x0040 /* XLOG consumption */
#define CHECKPOINT_CAUSE_TIME 0x0080 /* Elapsed time */
/* Checkpoint statistics */
typedef struct CheckpointStatsData
{
TimestampTz ckpt_start_t; /* start of checkpoint */
TimestampTz ckpt_write_t; /* start of flushing buffers */
TimestampTz ckpt_sync_t; /* start of fsyncs */
TimestampTz ckpt_sync_end_t; /* end of fsyncs */
TimestampTz ckpt_end_t; /* end of checkpoint */
int ckpt_bufs_written; /* # of buffers written */
int ckpt_segs_added; /* # of new xlog segments created */
int ckpt_segs_removed; /* # of xlog segments deleted */
int ckpt_segs_recycled; /* # of xlog segments recycled */
int ckpt_sync_rels; /* # of relations synced */
uint64 ckpt_longest_sync; /* Longest sync for one relation */
uint64 ckpt_agg_sync_time; /* The sum of all the individual sync
* times, which is not necessarily the
* same as the total elapsed time for
* the entire sync phase. */
} CheckpointStatsData;
extern CheckpointStatsData CheckpointStats;
struct XLogRecData;
extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata, XLogRecPtr fpw_lsn);
extern void XLogFlush(XLogRecPtr RecPtr);
extern bool XLogBackgroundFlush(void);
extern bool XLogNeedsFlush(XLogRecPtr RecPtr);
extern int XLogFileInit(XLogSegNo segno, bool *use_existent, bool use_lock);
extern int XLogFileOpen(XLogSegNo segno);
extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli);
extern XLogSegNo XLogGetLastRemovedSegno(void);
extern void XLogSetAsyncXactLSN(XLogRecPtr record);
extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn);
extern void xlog_redo(XLogReaderState *record);
extern void xlog_desc(StringInfo buf, XLogReaderState *record);
extern const char *xlog_identify(uint8 info);
extern void issue_xlog_fsync(int fd, XLogSegNo segno);
extern bool RecoveryInProgress(void);
extern bool HotStandbyActive(void);
extern bool HotStandbyActiveInReplay(void);
extern bool XLogInsertAllowed(void);
extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream);
extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI);
extern XLogRecPtr GetXLogInsertRecPtr(void);
extern XLogRecPtr GetXLogWriteRecPtr(void);
extern bool RecoveryIsPaused(void);
extern void SetRecoveryPause(bool recoveryPause);
extern TimestampTz GetLatestXTime(void);
extern TimestampTz GetCurrentChunkReplayStartTime(void);
extern char *XLogFileNameP(TimeLineID tli, XLogSegNo segno);
extern void UpdateControlFile(void);
extern uint64 GetSystemIdentifier(void);
extern bool DataChecksumsEnabled(void);
extern XLogRecPtr GetFakeLSNForUnloggedRel(void);
extern Size XLOGShmemSize(void);
extern void XLOGShmemInit(void);
extern void BootStrapXLOG(void);
extern void StartupXLOG(void);
extern void ShutdownXLOG(int code, Datum arg);
extern void InitXLOGAccess(void);
extern void CreateCheckPoint(int flags);
extern bool CreateRestartPoint(int flags);
extern void XLogPutNextOid(Oid nextOid);
extern XLogRecPtr XLogRestorePoint(const char *rpName);
extern void UpdateFullPageWrites(void);
extern void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p);
extern XLogRecPtr GetRedoRecPtr(void);
extern XLogRecPtr GetInsertRecPtr(void);
extern XLogRecPtr GetFlushRecPtr(void);
extern void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch);
extern void RemovePromoteSignalFiles(void);
extern bool CheckPromoteSignal(void);
extern void WakeupRecovery(void);
extern void SetWalWriterSleeping(bool sleeping);
extern void XLogRequestWalReceiverReply(void);
extern void assign_max_wal_size(int newval, void *extra);
extern void assign_checkpoint_completion_target(double newval, void *extra);
/*
* Starting/stopping a base backup
*/
extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast,
TimeLineID *starttli_p, StringInfo labelfile, DIR *tblspcdir,
List **tablespaces, StringInfo tblspcmapfile, bool infotbssize,
bool needtblspcmapfile);
extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive,
TimeLineID *stoptli_p);
extern void do_pg_abort_backup(void);
/* File path names (all relative to $PGDATA) */
#define BACKUP_LABEL_FILE "backup_label"
#define BACKUP_LABEL_OLD "backup_label.old"
#define TABLESPACE_MAP "tablespace_map"
#define TABLESPACE_MAP_OLD "tablespace_map.old"
#endif /* XLOG_H */
# 295 "../../../../src/include/access/xlog.h"
# 19 "../../../../src/include/utils/rel.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "catalog/pg_class.h"
#endif /* expanded by -frewrite-includes */
# 19 "../../../../src/include/utils/rel.h"
# 1 "../../../../src/include/catalog/pg_class.h" 1
/*-------------------------------------------------------------------------
*
* pg_class.h
* definition of the system "relation" relation (pg_class)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_class.h
*
* NOTES
* the genbki.pl script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_CLASS_H
#define PG_CLASS_H
#if 0 /* expanded by -frewrite-includes */
#include "catalog/genbki.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/catalog/pg_class.h"
# 23 "../../../../src/include/catalog/pg_class.h"
/* ----------------
* pg_class definition. cpp turns this into
* typedef struct FormData_pg_class
* ----------------
*/
#define RelationRelationId 1259
#define RelationRelation_Rowtype_Id 83
CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
{
NameData relname; /* class name */
Oid relnamespace; /* OID of namespace containing this class */
Oid reltype; /* OID of entry in pg_type for table's
* implicit row type */
Oid reloftype; /* OID of entry in pg_type for underlying
* composite type */
Oid relowner; /* class owner */
Oid relam; /* index access method; 0 if not an index */
Oid relfilenode; /* identifier of physical storage file */
/* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
Oid reltablespace; /* identifier of table space for relation */
int32 relpages; /* # of blocks (not always up-to-date) */
float4 reltuples; /* # of tuples (not always up-to-date) */
int32 relallvisible; /* # of all-visible blocks (not always
* up-to-date) */
Oid reltoastrelid; /* OID of toast table; 0 if none */
bool relhasindex; /* T if has (or has had) any indexes */
bool relisshared; /* T if shared across databases */
char relpersistence; /* see RELPERSISTENCE_xxx constants below */
char relkind; /* see RELKIND_xxx constants below */
int16 relnatts; /* number of user attributes */
/*
* Class pg_attribute must contain exactly "relnatts" user attributes
* (with attnums ranging from 1 to relnatts) for this class. It may also
* contain entries with negative attnums for system attributes.
*/
int16 relchecks; /* # of CHECK constraints for class */
bool relhasoids; /* T if we generate OIDs for rows of rel */
bool relhaspkey; /* has (or has had) PRIMARY KEY index */
bool relhasrules; /* has (or has had) any rules */
bool relhastriggers; /* has (or has had) any TRIGGERs */
bool relhassubclass; /* has (or has had) derived classes */
bool relrowsecurity; /* row security is enabled or not */
bool relforcerowsecurity; /* row security forced for owners or
* not */
bool relispopulated; /* matview currently holds query results */
char relreplident; /* see REPLICA_IDENTITY_xxx constants */
TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
TransactionId relminmxid; /* all multixacts in this rel are >= this.
* this is really a MultiXactId */
#ifdef CATALOG_VARLEN /* variable-length fields start here */
/* NOTE: These fields are not present in a relcache entry's rd_rel field. */
aclitem relacl[1]; /* access permissions */
text reloptions[1]; /* access-method-specific options */
#endif
# 82 "../../../../src/include/catalog/pg_class.h"
} FormData_pg_class;
/* Size of fixed part of pg_class tuples, not counting var-length fields */
#define CLASS_TUPLE_SIZE \
(offsetof(FormData_pg_class,relminmxid) + sizeof(TransactionId))
/* ----------------
* Form_pg_class corresponds to a pointer to a tuple with
* the format of pg_class relation.
* ----------------
*/
typedef FormData_pg_class *Form_pg_class;
/* ----------------
* compiler constants for pg_class
* ----------------
*/
#define Natts_pg_class 31
#define Anum_pg_class_relname 1
#define Anum_pg_class_relnamespace 2
#define Anum_pg_class_reltype 3
#define Anum_pg_class_reloftype 4
#define Anum_pg_class_relowner 5
#define Anum_pg_class_relam 6
#define Anum_pg_class_relfilenode 7
#define Anum_pg_class_reltablespace 8
#define Anum_pg_class_relpages 9
#define Anum_pg_class_reltuples 10
#define Anum_pg_class_relallvisible 11
#define Anum_pg_class_reltoastrelid 12
#define Anum_pg_class_relhasindex 13
#define Anum_pg_class_relisshared 14
#define Anum_pg_class_relpersistence 15
#define Anum_pg_class_relkind 16
#define Anum_pg_class_relnatts 17
#define Anum_pg_class_relchecks 18
#define Anum_pg_class_relhasoids 19
#define Anum_pg_class_relhaspkey 20
#define Anum_pg_class_relhasrules 21
#define Anum_pg_class_relhastriggers 22
#define Anum_pg_class_relhassubclass 23
#define Anum_pg_class_relrowsecurity 24
#define Anum_pg_class_relforcerowsecurity 25
#define Anum_pg_class_relispopulated 26
#define Anum_pg_class_relreplident 27
#define Anum_pg_class_relfrozenxid 28
#define Anum_pg_class_relminmxid 29
#define Anum_pg_class_relacl 30
#define Anum_pg_class_reloptions 31
/* ----------------
* initial contents of pg_class
*
* NOTE: only "bootstrapped" relations need to be declared here. Be sure that
* the OIDs listed here match those given in their CATALOG macros, and that
* the relnatts values are correct.
* ----------------
*/
/*
* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId;
* similarly, "1" in relminmxid stands for FirstMultiXactId
*/
DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 30 0 t f f f f f f t n 3 1 _null_ _null_ ));
DESCR("");
DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 21 0 f f f f f f f t n 3 1 _null_ _null_ ));
DESCR("");
DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 29 0 t f f f f f f t n 3 1 _null_ _null_ ));
DESCR("");
DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 31 0 t f f f f f f t n 3 1 _null_ _null_ ));
DESCR("");
#define RELKIND_RELATION 'r' /* ordinary table */
#define RELKIND_INDEX 'i' /* secondary index */
#define RELKIND_SEQUENCE 'S' /* sequence object */
#define RELKIND_TOASTVALUE 't' /* for out-of-line values */
#define RELKIND_VIEW 'v' /* view */
#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */
#define RELKIND_MATVIEW 'm' /* materialized view */
#define RELPERSISTENCE_PERMANENT 'p' /* regular table */
#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */
#define RELPERSISTENCE_TEMP 't' /* temporary table */
/* default selection for replica identity (primary key or nothing) */
#define REPLICA_IDENTITY_DEFAULT 'd'
/* no replica identity is logged for this relation */
#define REPLICA_IDENTITY_NOTHING 'n'
/* all columns are logged as replica identity */
#define REPLICA_IDENTITY_FULL 'f'
/*
* an explicitly chosen candidate key's columns are used as identity;
* will still be set if the index has been dropped, in that case it
* has the same meaning as 'd'
*/
#define REPLICA_IDENTITY_INDEX 'i'
#endif /* PG_CLASS_H */
# 182 "../../../../src/include/catalog/pg_class.h"
# 20 "../../../../src/include/utils/rel.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "catalog/pg_index.h"
#endif /* expanded by -frewrite-includes */
# 20 "../../../../src/include/utils/rel.h"
# 1 "../../../../src/include/catalog/pg_index.h" 1
/*-------------------------------------------------------------------------
*
* pg_index.h
* definition of the system "index" relation (pg_index)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_index.h
*
* NOTES
* the genbki.pl script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_INDEX_H
#define PG_INDEX_H
#if 0 /* expanded by -frewrite-includes */
#include "catalog/genbki.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/catalog/pg_index.h"
# 23 "../../../../src/include/catalog/pg_index.h"
/* ----------------
* pg_index definition. cpp turns this into
* typedef struct FormData_pg_index.
* ----------------
*/
#define IndexRelationId 2610
CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
{
Oid indexrelid; /* OID of the index */
Oid indrelid; /* OID of the relation it indexes */
int16 indnatts; /* number of columns in index */
bool indisunique; /* is this a unique index? */
bool indisprimary; /* is this index for primary key? */
bool indisexclusion; /* is this index for exclusion constraint? */
bool indimmediate; /* is uniqueness enforced immediately? */
bool indisclustered; /* is this the index last clustered by? */
bool indisvalid; /* is this index valid for use by queries? */
bool indcheckxmin; /* must we wait for xmin to be old? */
bool indisready; /* is this index ready for inserts? */
bool indislive; /* is this index alive at all? */
bool indisreplident; /* is this index the identity for replication? */
/* variable-length fields start here, but we allow direct access to indkey */
int2vector indkey; /* column numbers of indexed cols, or 0 */
#ifdef CATALOG_VARLEN
oidvector indcollation; /* collation identifiers */
oidvector indclass; /* opclass identifiers */
int2vector indoption; /* per-column flags (AM-specific meanings) */
pg_node_tree indexprs; /* expression trees for index attributes that
* are not simple column references; one for
* each zero entry in indkey[] */
pg_node_tree indpred; /* expression tree for predicate, if a partial
* index; else NULL */
#endif
# 60 "../../../../src/include/catalog/pg_index.h"
} FormData_pg_index;
/* ----------------
* Form_pg_index corresponds to a pointer to a tuple with
* the format of pg_index relation.
* ----------------
*/
typedef FormData_pg_index *Form_pg_index;
/* ----------------
* compiler constants for pg_index
* ----------------
*/
#define Natts_pg_index 19
#define Anum_pg_index_indexrelid 1
#define Anum_pg_index_indrelid 2
#define Anum_pg_index_indnatts 3
#define Anum_pg_index_indisunique 4
#define Anum_pg_index_indisprimary 5
#define Anum_pg_index_indisexclusion 6
#define Anum_pg_index_indimmediate 7
#define Anum_pg_index_indisclustered 8
#define Anum_pg_index_indisvalid 9
#define Anum_pg_index_indcheckxmin 10
#define Anum_pg_index_indisready 11
#define Anum_pg_index_indislive 12
#define Anum_pg_index_indisreplident 13
#define Anum_pg_index_indkey 14
#define Anum_pg_index_indcollation 15
#define Anum_pg_index_indclass 16
#define Anum_pg_index_indoption 17
#define Anum_pg_index_indexprs 18
#define Anum_pg_index_indpred 19
/*
* Index AMs that support ordered scans must support these two indoption
* bits. Otherwise, the content of the per-column indoption fields is
* open for future definition.
*/
#define INDOPTION_DESC 0x0001 /* values are in reverse order */
#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */
/*
* Use of these macros is recommended over direct examination of the state
* flag columns where possible; this allows source code compatibility with
* the hacky representation used in 9.2.
*/
#define IndexIsValid(indexForm) ((indexForm)->indisvalid)
#define IndexIsReady(indexForm) ((indexForm)->indisready)
#define IndexIsLive(indexForm) ((indexForm)->indislive)
#endif /* PG_INDEX_H */
# 112 "../../../../src/include/catalog/pg_index.h"
# 21 "../../../../src/include/utils/rel.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "fmgr.h"
#endif /* expanded by -frewrite-includes */
# 21 "../../../../src/include/utils/rel.h"
# 22 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "nodes/bitmapset.h"
#endif /* expanded by -frewrite-includes */
# 22 "../../../../src/include/utils/rel.h"
# 23 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "rewrite/prs2lock.h"
#endif /* expanded by -frewrite-includes */
# 23 "../../../../src/include/utils/rel.h"
# 1 "../../../../src/include/rewrite/prs2lock.h" 1
/*-------------------------------------------------------------------------
*
* prs2lock.h
* data structures for POSTGRES Rule System II (rewrite rules only)
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/rewrite/prs2lock.h
*
*-------------------------------------------------------------------------
*/
#ifndef PRS2LOCK_H
#define PRS2LOCK_H
#if 0 /* expanded by -frewrite-includes */
#include "access/attnum.h"
#endif /* expanded by -frewrite-includes */
# 16 "../../../../src/include/rewrite/prs2lock.h"
# 17 "../../../../src/include/rewrite/prs2lock.h"
#if 0 /* expanded by -frewrite-includes */
#include "nodes/pg_list.h"
#endif /* expanded by -frewrite-includes */
# 17 "../../../../src/include/rewrite/prs2lock.h"
# 18 "../../../../src/include/rewrite/prs2lock.h"
/*
* RewriteRule -
* holds an info for a rewrite rule
*
*/
typedef struct RewriteRule
{
Oid ruleId;
CmdType event;
Node *qual;
List *actions;
char enabled;
bool isInstead;
} RewriteRule;
/*
* RuleLock -
* all rules that apply to a particular relation. Even though we only
* have the rewrite rule system left and these are not really "locks",
* the name is kept for historical reasons.
*/
typedef struct RuleLock
{
int numLocks;
RewriteRule **rules;
} RuleLock;
#endif /* REWRITE_H */
# 47 "../../../../src/include/rewrite/prs2lock.h"
# 24 "../../../../src/include/utils/rel.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "storage/block.h"
#endif /* expanded by -frewrite-includes */
# 24 "../../../../src/include/utils/rel.h"
# 25 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "storage/relfilenode.h"
#endif /* expanded by -frewrite-includes */
# 25 "../../../../src/include/utils/rel.h"
# 26 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/relcache.h"
#endif /* expanded by -frewrite-includes */
# 26 "../../../../src/include/utils/rel.h"
# 27 "../../../../src/include/utils/rel.h"
#if 0 /* expanded by -frewrite-includes */
#include "utils/reltrigger.h"
#endif /* expanded by -frewrite-includes */
# 27 "../../../../src/include/utils/rel.h"
# 1 "../../../../src/include/utils/reltrigger.h" 1
/*-------------------------------------------------------------------------
*
* reltrigger.h
* POSTGRES relation trigger definitions.
*
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/reltrigger.h
*
*-------------------------------------------------------------------------
*/
#ifndef RELTRIGGER_H
#define RELTRIGGER_H
/*
* These struct really belongs to trigger.h, but we put it separately so that
* it can be cleanly included in rel.h and other places.
*/
typedef struct Trigger
{
Oid tgoid; /* OID of trigger (pg_trigger row) */
/* Remaining fields are copied from pg_trigger, see pg_trigger.h */
char *tgname;
Oid tgfoid;
int16 tgtype;
char tgenabled;
bool tgisinternal;
Oid tgconstrrelid;
Oid tgconstrindid;
Oid tgconstraint;
bool tgdeferrable;
bool tginitdeferred;
int16 tgnargs;
int16 tgnattr;
int16 *tgattr;
char **tgargs;
char *tgqual;
} Trigger;
typedef struct TriggerDesc
{
Trigger *triggers; /* array of Trigger structs */
int numtriggers; /* number of array entries */
/*
* These flags indicate whether the array contains at least one of each
* type of trigger. We use these to skip searching the array if not.
*/
bool trig_insert_before_row;
bool trig_insert_after_row;
bool trig_insert_instead_row;
bool trig_insert_before_statement;
bool trig_insert_after_statement;
bool trig_update_before_row;
bool trig_update_after_row;
bool trig_update_instead_row;
bool trig_update_before_statement;
bool trig_update_after_statement;
bool trig_delete_before_row;
bool trig_delete_after_row;
bool trig_delete_instead_row;
bool trig_delete_before_statement;
bool trig_delete_after_statement;
/* there are no row-level truncate triggers */
bool trig_truncate_before_statement;
bool trig_truncate_after_statement;
} TriggerDesc;
#endif /* RELTRIGGER_H */
# 74 "../../../../src/include/utils/reltrigger.h"
# 28 "../../../../src/include/utils/rel.h" 2
/*
* LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
* to declare them here so we can have a LockInfoData field in a Relation.
*/
typedef struct LockRelId
{
Oid relId; /* a relation identifier */
Oid dbId; /* a database identifier */
} LockRelId;
typedef struct LockInfoData
{
LockRelId lockRelId;
} LockInfoData;
typedef LockInfoData *LockInfo;
/*
* Here are the contents of a relation cache entry.
*/
typedef struct RelationData
{
RelFileNode rd_node; /* relation physical identifier */
/* use "struct" here to avoid needing to include smgr.h: */
struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */
int rd_refcnt; /* reference count */
BackendId rd_backend; /* owning backend id, if temporary relation */
bool rd_islocaltemp; /* rel is a temp rel of this session */
bool rd_isnailed; /* rel is nailed in cache */
bool rd_isvalid; /* relcache entry is valid */
char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 =
* valid, 2 = temporarily forced */
/*
* rd_createSubid is the ID of the highest subtransaction the rel has
* survived into; or zero if the rel was not created in the current top
* transaction. This can be now be relied on, whereas previously it could
* be "forgotten" in earlier releases. Likewise, rd_newRelfilenodeSubid is
* the ID of the highest subtransaction the relfilenode change has
* survived into, or zero if not changed in the current transaction (or we
* have forgotten changing it). rd_newRelfilenodeSubid can be forgotten
* when a relation has multiple new relfilenodes within a single
* transaction, with one of them occurring in a subsequently aborted
* subtransaction, e.g. BEGIN; TRUNCATE t; SAVEPOINT save; TRUNCATE t;
* ROLLBACK TO save; -- rd_newRelfilenode is now forgotten
*/
SubTransactionId rd_createSubid; /* rel was created in current xact */
SubTransactionId rd_newRelfilenodeSubid; /* new relfilenode assigned in
* current xact */
Form_pg_class rd_rel; /* RELATION tuple */
TupleDesc rd_att; /* tuple descriptor */
Oid rd_id; /* relation's object id */
LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */
RuleLock *rd_rules; /* rewrite rules */
MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */
TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */
/* use "struct" here to avoid needing to include rowsecurity.h: */
struct RowSecurityDesc *rd_rsdesc; /* row security policies, or NULL */
/* data managed by RelationGetFKeyList: */
List *rd_fkeylist; /* list of ForeignKeyCacheInfo (see below) */
bool rd_fkeyvalid; /* true if list has been computed */
/* data managed by RelationGetIndexList: */
List *rd_indexlist; /* list of OIDs of indexes on relation */
Oid rd_oidindex; /* OID of unique index on OID, if any */
Oid rd_replidindex; /* OID of replica identity index, if any */
/* data managed by RelationGetIndexAttrBitmap: */
Bitmapset *rd_indexattr; /* identifies columns used in indexes */
Bitmapset *rd_keyattr; /* cols that can be ref'd by foreign keys */
Bitmapset *rd_idattr; /* included in replica identity index */
/*
* rd_options is set whenever rd_rel is loaded into the relcache entry.
* Note that you can NOT look into rd_rel for this data. NULL means "use
* defaults".
*/
bytea *rd_options; /* parsed pg_class.reloptions */
/* These are non-NULL only for an index relation: */
Form_pg_index rd_index; /* pg_index tuple describing this index */
/* use "struct" here to avoid needing to include htup.h: */
struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */
/*
* index access support info (used only for an index relation)
*
* Note: only default support procs for each opclass are cached, namely
* those with lefttype and righttype equal to the opclass's opcintype. The
* arrays are indexed by support function number, which is a sufficient
* identifier given that restriction.
*
* Note: rd_amcache is available for index AMs to cache private data about
* an index. This must be just a cache since it may get reset at any time
* (in particular, it will get reset by a relcache inval message for the
* index). If used, it must point to a single memory chunk palloc'd in
* rd_indexcxt. A relcache reset will include freeing that chunk and
* setting rd_amcache = NULL.
*/
Oid rd_amhandler; /* OID of index AM's handler function */
MemoryContext rd_indexcxt; /* private memory cxt for this stuff */
/* use "struct" here to avoid needing to include amapi.h: */
struct IndexAmRoutine *rd_amroutine; /* index AM's API struct */
Oid *rd_opfamily; /* OIDs of op families for each index col */
Oid *rd_opcintype; /* OIDs of opclass declared input data types */
RegProcedure *rd_support; /* OIDs of support procedures */
FmgrInfo *rd_supportinfo; /* lookup info for support procedures */
int16 *rd_indoption; /* per-column AM-specific flags */
List *rd_indexprs; /* index expression trees, if any */
List *rd_indpred; /* index predicate tree, if any */
Oid *rd_exclops; /* OIDs of exclusion operators, if any */
Oid *rd_exclprocs; /* OIDs of exclusion ops' procs, if any */
uint16 *rd_exclstrats; /* exclusion ops' strategy numbers, if any */
void *rd_amcache; /* available for use by index AM */
Oid *rd_indcollation; /* OIDs of index collations */
/*
* foreign-table support
*
* rd_fdwroutine must point to a single memory chunk palloc'd in
* CacheMemoryContext. It will be freed and reset to NULL on a relcache
* reset.
*/
/* use "struct" here to avoid needing to include fdwapi.h: */
struct FdwRoutine *rd_fdwroutine; /* cached function pointers, or NULL */
/*
* Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new
* version of a table, we need to make any toast pointers inserted into it
* have the existing toast table's OID, not the OID of the transient toast
* table. If rd_toastoid isn't InvalidOid, it is the OID to place in
* toast pointers inserted into this rel. (Note it's set on the new
* version of the main heap, not the toast table itself.) This also
* causes toast_save_datum() to try to preserve toast value OIDs.
*/
Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */
/* use "struct" here to avoid needing to include pgstat.h: */
struct PgStat_TableStatus *pgstat_info; /* statistics collection area */
} RelationData;
/*
* ForeignKeyCacheInfo
* Information the relcache can cache about foreign key constraints
*
* This is basically just an image of relevant columns from pg_constraint.
* We make it a subclass of Node so that copyObject() can be used on a list
* of these, but we also ensure it is a "flat" object without substructure,
* so that list_free_deep() is sufficient to free such a list.
* The per-FK-column arrays can be fixed-size because we allow at most
* INDEX_MAX_KEYS columns in a foreign key constraint.
*
* Currently, we only cache fields of interest to the planner, but the
* set of fields could be expanded in future.
*/
typedef struct ForeignKeyCacheInfo
{
NodeTag type;
Oid conrelid; /* relation constrained by the foreign key */
Oid confrelid; /* relation referenced by the foreign key */
int nkeys; /* number of columns in the foreign key */
/* these arrays each have nkeys valid entries: */
AttrNumber conkey[INDEX_MAX_KEYS]; /* cols in referencing table */
AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */
Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */
} ForeignKeyCacheInfo;
/*
* StdRdOptions
* Standard contents of rd_options for heaps and generic indexes.
*
* RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only
* be applied to relations that use this format or a superset for
* private options data.
*/
/* autovacuum-related reloptions. */
typedef struct AutoVacOpts
{
bool enabled;
int vacuum_threshold;
int analyze_threshold;
int vacuum_cost_delay;
int vacuum_cost_limit;
int freeze_min_age;
int freeze_max_age;
int freeze_table_age;
int multixact_freeze_min_age;
int multixact_freeze_max_age;
int multixact_freeze_table_age;
int log_min_duration;
float8 vacuum_scale_factor;
float8 analyze_scale_factor;
} AutoVacOpts;
typedef struct StdRdOptions
{
int32 vl_len_; /* varlena header (do not touch directly!) */
int fillfactor; /* page fill factor in percent (0..100) */
AutoVacOpts autovacuum; /* autovacuum-related options */
bool user_catalog_table; /* use as an additional catalog
* relation */
int parallel_workers; /* max number of parallel workers */
} StdRdOptions;
#define HEAP_MIN_FILLFACTOR 10
#define HEAP_DEFAULT_FILLFACTOR 100
/*
* RelationGetFillFactor
* Returns the relation's fillfactor. Note multiple eval of argument!
*/
#define RelationGetFillFactor(relation, defaultff) \
((relation)->rd_options ? \
((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
/*
* RelationGetTargetPageUsage
* Returns the relation's desired space usage per page in bytes.
*/
#define RelationGetTargetPageUsage(relation, defaultff) \
(BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
/*
* RelationGetTargetPageFreeSpace
* Returns the relation's desired freespace per page in bytes.
*/
#define RelationGetTargetPageFreeSpace(relation, defaultff) \
(BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
/*
* RelationIsUsedAsCatalogTable
* Returns whether the relation should be treated as a catalog table
* from the pov of logical decoding. Note multiple eval of argument!
*/
#define RelationIsUsedAsCatalogTable(relation) \
((relation)->rd_options && \
((relation)->rd_rel->relkind == RELKIND_RELATION || \
(relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
/*
* RelationGetParallelWorkers
* Returns the relation's parallel_workers reloption setting.
* Note multiple eval of argument!
*/
#define RelationGetParallelWorkers(relation, defaultpw) \
((relation)->rd_options ? \
((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
/*
* ViewOptions
* Contents of rd_options for views
*/
typedef struct ViewOptions
{
int32 vl_len_; /* varlena header (do not touch directly!) */
bool security_barrier;
int check_option_offset;
} ViewOptions;
/*
* RelationIsSecurityView
* Returns whether the relation is security view, or not. Note multiple
* eval of argument!
*/
#define RelationIsSecurityView(relation) \
((relation)->rd_options ? \
((ViewOptions *) (relation)->rd_options)->security_barrier : false)
/*
* RelationHasCheckOption
* Returns true if the relation is a view defined with either the local
* or the cascaded check option. Note multiple eval of argument!
*/
#define RelationHasCheckOption(relation) \
((relation)->rd_options && \
((ViewOptions *) (relation)->rd_options)->check_option_offset != 0)
/*
* RelationHasLocalCheckOption
* Returns true if the relation is a view defined with the local check
* option. Note multiple eval of argument!
*/
#define RelationHasLocalCheckOption(relation) \
((relation)->rd_options && \
((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
strcmp((char *) (relation)->rd_options + \
((ViewOptions *) (relation)->rd_options)->check_option_offset, \
"local") == 0 : false)
/*
* RelationHasCascadedCheckOption
* Returns true if the relation is a view defined with the cascaded check
* option. Note multiple eval of argument!
*/
#define RelationHasCascadedCheckOption(relation) \
((relation)->rd_options && \
((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
strcmp((char *) (relation)->rd_options + \
((ViewOptions *) (relation)->rd_options)->check_option_offset, \
"cascaded") == 0 : false)
/*
* RelationIsValid
* True iff relation descriptor is valid.
*/
#define RelationIsValid(relation) PointerIsValid(relation)
#define InvalidRelation ((Relation) NULL)
/*
* RelationHasReferenceCountZero
* True iff relation reference count is zero.
*
* Note:
* Assumes relation descriptor is valid.
*/
#define RelationHasReferenceCountZero(relation) \
((bool)((relation)->rd_refcnt == 0))
/*
* RelationGetForm
* Returns pg_class tuple for a relation.
*
* Note:
* Assumes relation descriptor is valid.
*/
#define RelationGetForm(relation) ((relation)->rd_rel)
/*
* RelationGetRelid
* Returns the OID of the relation
*/
#define RelationGetRelid(relation) ((relation)->rd_id)
/*
* RelationGetNumberOfAttributes
* Returns the number of attributes in a relation.
*/
#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
/*
* RelationGetDescr
* Returns tuple descriptor for a relation.
*/
#define RelationGetDescr(relation) ((relation)->rd_att)
/*
* RelationGetRelationName
* Returns the rel's name.
*
* Note that the name is only unique within the containing namespace.
*/
#define RelationGetRelationName(relation) \
(NameStr((relation)->rd_rel->relname))
/*
* RelationGetNamespace
* Returns the rel's namespace OID.
*/
#define RelationGetNamespace(relation) \
((relation)->rd_rel->relnamespace)
/*
* RelationIsMapped
* True if the relation uses the relfilenode map.
*
* NB: this is only meaningful for relkinds that have storage, else it
* will misleadingly say "true".
*/
#define RelationIsMapped(relation) \
((relation)->rd_rel->relfilenode == InvalidOid)
/*
* RelationOpenSmgr
* Open the relation at the smgr level, if not already done.
*/
#define RelationOpenSmgr(relation) \
do { \
if ((relation)->rd_smgr == NULL) \
smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \
} while (0)
/*
* RelationCloseSmgr
* Close the relation at the smgr level, if not already done.
*
* Note: smgrclose should unhook from owner pointer, hence the Assert.
*/
#define RelationCloseSmgr(relation) \
do { \
if ((relation)->rd_smgr != NULL) \
{ \
smgrclose((relation)->rd_smgr); \
Assert((relation)->rd_smgr == NULL); \
} \
} while (0)
/*
* RelationGetTargetBlock
* Fetch relation's current insertion target block.
*
* Returns InvalidBlockNumber if there is no current target block. Note
* that the target block status is discarded on any smgr-level invalidation.
*/
#define RelationGetTargetBlock(relation) \
( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
/*
* RelationSetTargetBlock
* Set relation's current insertion target block.
*/
#define RelationSetTargetBlock(relation, targblock) \
do { \
RelationOpenSmgr(relation); \
(relation)->rd_smgr->smgr_targblock = (targblock); \
} while (0)
/*
* RelationNeedsWAL
* True if relation needs WAL.
*/
#define RelationNeedsWAL(relation) \
((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
/*
* RelationUsesLocalBuffers
* True if relation's pages are stored in local buffers.
*/
#define RelationUsesLocalBuffers(relation) \
((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
/*
* RELATION_IS_LOCAL
* If a rel is either temp or newly created in the current transaction,
* it can be assumed to be accessible only to the current backend.
* This is typically used to decide that we can skip acquiring locks.
*
* Beware of multiple eval of argument
*/
#define RELATION_IS_LOCAL(relation) \
((relation)->rd_islocaltemp || \
(relation)->rd_createSubid != InvalidSubTransactionId)
/*
* RELATION_IS_OTHER_TEMP
* Test for a temporary relation that belongs to some other session.
*
* Beware of multiple eval of argument
*/
#define RELATION_IS_OTHER_TEMP(relation) \
((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
!(relation)->rd_islocaltemp)
/*
* RelationIsScannable
* Currently can only be false for a materialized view which has not been
* populated by its query. This is likely to get more complicated later,
* so use a macro which looks like a function.
*/
#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
/*
* RelationIsPopulated
* Currently, we don't physically distinguish the "populated" and
* "scannable" properties of matviews, but that may change later.
* Hence, use the appropriate one of these macros in code tests.
*/
#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
/*
* RelationIsAccessibleInLogicalDecoding
* True if we need to log enough information to have access via
* decoding snapshot.
*/
#define RelationIsAccessibleInLogicalDecoding(relation) \
(XLogLogicalInfoActive() && \
RelationNeedsWAL(relation) && \
(IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
/*
* RelationIsLogicallyLogged
* True if we need to log enough information to extract the data from the
* WAL stream.
*
* We don't log information for unlogged tables (since they don't WAL log
* anyway) and for system tables (their content is hard to make sense of, and
* it would complicate decoding slightly for little gain). Note that we *do*
* log information for user defined catalog tables since they presumably are
* interesting to the user...
*/
#define RelationIsLogicallyLogged(relation) \
(XLogLogicalInfoActive() && \
RelationNeedsWAL(relation) && \
!IsCatalogRelation(relation))
/* routines in utils/cache/relcache.c */
extern void RelationIncrementReferenceCount(Relation rel);
extern void RelationDecrementReferenceCount(Relation rel);
extern bool RelationHasUnloggedIndex(Relation rel);
#endif /* REL_H */
# 543 "../../../../src/include/utils/rel.h"
# 24 "spgdoinsert.c" 2
/*
* SPPageDesc tracks all info about a page we are inserting into. In some
* situations it actually identifies a tuple, or even a specific node within
* an inner tuple. But any of the fields can be invalid. If the buffer
* field is valid, it implies we hold pin and exclusive lock on that buffer.
* page pointer should be valid exactly when buffer is.
*/
typedef struct SPPageDesc
{
BlockNumber blkno; /* block number, or InvalidBlockNumber */
Buffer buffer; /* page's buffer number, or InvalidBuffer */
Page page; /* pointer to page buffer, or NULL */
OffsetNumber offnum; /* offset of tuple, or InvalidOffsetNumber */
int node; /* node number within inner tuple, or -1 */
} SPPageDesc;
/*
* Set the item pointer in the nodeN'th entry in inner tuple tup. This
* is used to update the parent inner tuple's downlink after a move or
* split operation.
*/
void
spgUpdateNodeLink(SpGistInnerTuple tup, int nodeN,
BlockNumber blkno, OffsetNumber offset)
{
int i;
SpGistNodeTuple node;
SGITITERATE(tup, i, node)
{
if (i == nodeN)
{
ItemPointerSet(&node->t_tid, blkno, offset);
return;
}
}
elog(ERROR, "failed to find requested node %d in SPGiST inner tuple",
nodeN);
}
/*
* Form a new inner tuple containing one more node than the given one, with
* the specified label datum, inserted at offset "offset" in the node array.
* The new tuple's prefix is the same as the old one's.
*
* Note that the new node initially has an invalid downlink. We'll find a
* page to point it to later.
*/
static SpGistInnerTuple
addNode(SpGistState *state, SpGistInnerTuple tuple, Datum label, int offset)
{
SpGistNodeTuple node,
*nodes;
int i;
/* if offset is negative, insert at end */
if (offset < 0)
offset = tuple->nNodes;
else if (offset > tuple->nNodes)
elog(ERROR, "invalid offset for adding node to SPGiST inner tuple");
nodes = palloc(sizeof(SpGistNodeTuple) * (tuple->nNodes + 1));
SGITITERATE(tuple, i, node)
{
if (i < offset)
nodes[i] = node;
else
nodes[i + 1] = node;
}
nodes[offset] = spgFormNodeTuple(state, label, false);
return spgFormInnerTuple(state,
(tuple->prefixSize > 0),
SGITDATUM(tuple, state),
tuple->nNodes + 1,
nodes);
}
/* qsort comparator for sorting OffsetNumbers */
static int
cmpOffsetNumbers(const void *a, const void *b)
{
if (*(const OffsetNumber *) a == *(const OffsetNumber *) b)
return 0;
return (*(const OffsetNumber *) a > *(const OffsetNumber *) b) ? 1 : -1;
}
/*
* Delete multiple tuples from an index page, preserving tuple offset numbers.
*
* The first tuple in the given list is replaced with a dead tuple of type
* "firststate" (REDIRECT/DEAD/PLACEHOLDER); the remaining tuples are replaced
* with dead tuples of type "reststate". If either firststate or reststate
* is REDIRECT, blkno/offnum specify where to link to.
*
* NB: this is used during WAL replay, so beware of trying to make it too
* smart. In particular, it shouldn't use "state" except for calling
* spgFormDeadTuple(). This is also used in a critical section, so no
* pallocs either!
*/
void
spgPageIndexMultiDelete(SpGistState *state, Page page,
OffsetNumber *itemnos, int nitems,
int firststate, int reststate,
BlockNumber blkno, OffsetNumber offnum)
{
OffsetNumber firstItem;
OffsetNumber sortednos[MaxIndexTuplesPerPage];
SpGistDeadTuple tuple = NULL;
int i;
if (nitems == 0)
return; /* nothing to do */
/*
* For efficiency we want to use PageIndexMultiDelete, which requires the
* targets to be listed in sorted order, so we have to sort the itemnos
* array. (This also greatly simplifies the math for reinserting the
* replacement tuples.) However, we must not scribble on the caller's
* array, so we have to make a copy.
*/
memcpy(sortednos, itemnos, sizeof(OffsetNumber) * nitems);
if (nitems > 1)
qsort(sortednos, nitems, sizeof(OffsetNumber), cmpOffsetNumbers);
PageIndexMultiDelete(page, sortednos, nitems);
firstItem = itemnos[0];
for (i = 0; i < nitems; i++)
{
OffsetNumber itemno = sortednos[i];
int tupstate;
tupstate = (itemno == firstItem) ? firststate : reststate;
if (tuple == NULL || tuple->tupstate != tupstate)
tuple = spgFormDeadTuple(state, tupstate, blkno, offnum);
if (PageAddItem(page, (Item) tuple, tuple->size,
itemno, false, false) != itemno)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
tuple->size);
if (tupstate == SPGIST_REDIRECT)
SpGistPageGetOpaque(page)->nRedirection++;
else if (tupstate == SPGIST_PLACEHOLDER)
SpGistPageGetOpaque(page)->nPlaceholder++;
}
}
/*
* Update the parent inner tuple's downlink, and mark the parent buffer
* dirty (this must be the last change to the parent page in the current
* WAL action).
*/
static void
saveNodeLink(Relation index, SPPageDesc *parent,
BlockNumber blkno, OffsetNumber offnum)
{
SpGistInnerTuple innerTuple;
innerTuple = (SpGistInnerTuple) PageGetItem(parent->page,
PageGetItemId(parent->page, parent->offnum));
spgUpdateNodeLink(innerTuple, parent->node, blkno, offnum);
MarkBufferDirty(parent->buffer);
}
/*
* Add a leaf tuple to a leaf page where there is known to be room for it
*/
static void
addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple,
SPPageDesc *current, SPPageDesc *parent, bool isNulls, bool isNew)
{
spgxlogAddLeaf xlrec;
xlrec.newPage = isNew;
xlrec.storesNulls = isNulls;
/* these will be filled below as needed */
xlrec.offnumLeaf = InvalidOffsetNumber;
xlrec.offnumHeadLeaf = InvalidOffsetNumber;
xlrec.offnumParent = InvalidOffsetNumber;
xlrec.nodeI = 0;
START_CRIT_SECTION();
if (current->offnum == InvalidOffsetNumber ||
SpGistBlockIsRoot(current->blkno))
{
/* Tuple is not part of a chain */
leafTuple->nextOffset = InvalidOffsetNumber;
current->offnum = SpGistPageAddNewItem(state, current->page,
(Item) leafTuple, leafTuple->size,
NULL, false);
xlrec.offnumLeaf = current->offnum;
/* Must update parent's downlink if any */
if (parent->buffer != InvalidBuffer)
{
xlrec.offnumParent = parent->offnum;
xlrec.nodeI = parent->node;
saveNodeLink(index, parent, current->blkno, current->offnum);
}
}
else
{
/*
* Tuple must be inserted into existing chain. We mustn't change the
* chain's head address, but we don't need to chase the entire chain
* to put the tuple at the end; we can insert it second.
*
* Also, it's possible that the "chain" consists only of a DEAD tuple,
* in which case we should replace the DEAD tuple in-place.
*/
SpGistLeafTuple head;
OffsetNumber offnum;
head = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, current->offnum));
if (head->tupstate == SPGIST_LIVE)
{
leafTuple->nextOffset = head->nextOffset;
offnum = SpGistPageAddNewItem(state, current->page,
(Item) leafTuple, leafTuple->size,
NULL, false);
/*
* re-get head of list because it could have been moved on page,
* and set new second element
*/
head = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, current->offnum));
head->nextOffset = offnum;
xlrec.offnumLeaf = offnum;
xlrec.offnumHeadLeaf = current->offnum;
}
else if (head->tupstate == SPGIST_DEAD)
{
leafTuple->nextOffset = InvalidOffsetNumber;
PageIndexTupleDelete(current->page, current->offnum);
if (PageAddItem(current->page,
(Item) leafTuple, leafTuple->size,
current->offnum, false, false) != current->offnum)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
leafTuple->size);
/* WAL replay distinguishes this case by equal offnums */
xlrec.offnumLeaf = current->offnum;
xlrec.offnumHeadLeaf = current->offnum;
}
else
elog(ERROR, "unexpected SPGiST tuple state: %d", head->tupstate);
}
MarkBufferDirty(current->buffer);
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
int flags;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
XLogRegisterData((char *) leafTuple, leafTuple->size);
flags = REGBUF_STANDARD;
if (xlrec.newPage)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(0, current->buffer, flags);
if (xlrec.offnumParent != InvalidOffsetNumber)
XLogRegisterBuffer(1, parent->buffer, REGBUF_STANDARD);
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_LEAF);
PageSetLSN(current->page, recptr);
/* update parent only if we actually changed it */
if (xlrec.offnumParent != InvalidOffsetNumber)
{
PageSetLSN(parent->page, recptr);
}
}
END_CRIT_SECTION();
}
/*
* Count the number and total size of leaf tuples in the chain starting at
* current->offnum. Return number into *nToSplit and total size as function
* result.
*
* Klugy special case when considering the root page (i.e., root is a leaf
* page, but we're about to split for the first time): return fake large
* values to force spgdoinsert() to take the doPickSplit rather than
* moveLeafs code path. moveLeafs is not prepared to deal with root page.
*/
static int
checkSplitConditions(Relation index, SpGistState *state,
SPPageDesc *current, int *nToSplit)
{
int i,
n = 0,
totalSize = 0;
if (SpGistBlockIsRoot(current->blkno))
{
/* return impossible values to force split */
*nToSplit = BLCKSZ;
return BLCKSZ;
}
i = current->offnum;
while (i != InvalidOffsetNumber)
{
SpGistLeafTuple it;
Assert(i >= FirstOffsetNumber &&
i <= PageGetMaxOffsetNumber(current->page));
it = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, i));
if (it->tupstate == SPGIST_LIVE)
{
n++;
totalSize += it->size + sizeof(ItemIdData);
}
else if (it->tupstate == SPGIST_DEAD)
{
/* We could see a DEAD tuple as first/only chain item */
Assert(i == current->offnum);
Assert(it->nextOffset == InvalidOffsetNumber);
/* Don't count it in result, because it won't go to other page */
}
else
elog(ERROR, "unexpected SPGiST tuple state: %d", it->tupstate);
i = it->nextOffset;
}
*nToSplit = n;
return totalSize;
}
/*
* current points to a leaf-tuple chain that we wanted to add newLeafTuple to,
* but the chain has to be moved because there's not enough room to add
* newLeafTuple to its page. We use this method when the chain contains
* very little data so a split would be inefficient. We are sure we can
* fit the chain plus newLeafTuple on one other page.
*/
static void
moveLeafs(Relation index, SpGistState *state,
SPPageDesc *current, SPPageDesc *parent,
SpGistLeafTuple newLeafTuple, bool isNulls)
{
int i,
nDelete,
nInsert,
size;
Buffer nbuf;
Page npage;
SpGistLeafTuple it;
OffsetNumber r = InvalidOffsetNumber,
startOffset = InvalidOffsetNumber;
bool replaceDead = false;
OffsetNumber *toDelete;
OffsetNumber *toInsert;
BlockNumber nblkno;
spgxlogMoveLeafs xlrec;
char *leafdata,
*leafptr;
/* This doesn't work on root page */
Assert(parent->buffer != InvalidBuffer);
Assert(parent->buffer != current->buffer);
/* Locate the tuples to be moved, and count up the space needed */
i = PageGetMaxOffsetNumber(current->page);
toDelete = (OffsetNumber *) palloc(sizeof(OffsetNumber) * i);
toInsert = (OffsetNumber *) palloc(sizeof(OffsetNumber) * (i + 1));
size = newLeafTuple->size + sizeof(ItemIdData);
nDelete = 0;
i = current->offnum;
while (i != InvalidOffsetNumber)
{
SpGistLeafTuple it;
Assert(i >= FirstOffsetNumber &&
i <= PageGetMaxOffsetNumber(current->page));
it = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, i));
if (it->tupstate == SPGIST_LIVE)
{
toDelete[nDelete] = i;
size += it->size + sizeof(ItemIdData);
nDelete++;
}
else if (it->tupstate == SPGIST_DEAD)
{
/* We could see a DEAD tuple as first/only chain item */
Assert(i == current->offnum);
Assert(it->nextOffset == InvalidOffsetNumber);
/* We don't want to move it, so don't count it in size */
toDelete[nDelete] = i;
nDelete++;
replaceDead = true;
}
else
elog(ERROR, "unexpected SPGiST tuple state: %d", it->tupstate);
i = it->nextOffset;
}
/* Find a leaf page that will hold them */
nbuf = SpGistGetBuffer(index, GBUF_LEAF | (isNulls ? GBUF_NULLS : 0),
size, &xlrec.newPage);
npage = BufferGetPage(nbuf);
nblkno = BufferGetBlockNumber(nbuf);
Assert(nblkno != current->blkno);
leafdata = leafptr = palloc(size);
START_CRIT_SECTION();
/* copy all the old tuples to new page, unless they're dead */
nInsert = 0;
if (!replaceDead)
{
for (i = 0; i < nDelete; i++)
{
it = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, toDelete[i]));
Assert(it->tupstate == SPGIST_LIVE);
/*
* Update chain link (notice the chain order gets reversed, but we
* don't care). We're modifying the tuple on the source page
* here, but it's okay since we're about to delete it.
*/
it->nextOffset = r;
r = SpGistPageAddNewItem(state, npage, (Item) it, it->size,
&startOffset, false);
toInsert[nInsert] = r;
nInsert++;
/* save modified tuple into leafdata as well */
memcpy(leafptr, it, it->size);
leafptr += it->size;
}
}
/* add the new tuple as well */
newLeafTuple->nextOffset = r;
r = SpGistPageAddNewItem(state, npage,
(Item) newLeafTuple, newLeafTuple->size,
&startOffset, false);
toInsert[nInsert] = r;
nInsert++;
memcpy(leafptr, newLeafTuple, newLeafTuple->size);
leafptr += newLeafTuple->size;
/*
* Now delete the old tuples, leaving a redirection pointer behind for the
* first one, unless we're doing an index build; in which case there can't
* be any concurrent scan so we need not provide a redirect.
*/
spgPageIndexMultiDelete(state, current->page, toDelete, nDelete,
state->isBuild ? SPGIST_PLACEHOLDER : SPGIST_REDIRECT,
SPGIST_PLACEHOLDER,
nblkno, r);
/* Update parent's downlink and mark parent page dirty */
saveNodeLink(index, parent, nblkno, r);
/* Mark the leaf pages too */
MarkBufferDirty(current->buffer);
MarkBufferDirty(nbuf);
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
/* prepare WAL info */
STORE_STATE(state, xlrec.stateSrc);
xlrec.nMoves = nDelete;
xlrec.replaceDead = replaceDead;
xlrec.storesNulls = isNulls;
xlrec.offnumParent = parent->offnum;
xlrec.nodeI = parent->node;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, SizeOfSpgxlogMoveLeafs);
XLogRegisterData((char *) toDelete,
sizeof(OffsetNumber) * nDelete);
XLogRegisterData((char *) toInsert,
sizeof(OffsetNumber) * nInsert);
XLogRegisterData((char *) leafdata, leafptr - leafdata);
XLogRegisterBuffer(0, current->buffer, REGBUF_STANDARD);
XLogRegisterBuffer(1, nbuf, REGBUF_STANDARD | (xlrec.newPage ? REGBUF_WILL_INIT : 0));
XLogRegisterBuffer(2, parent->buffer, REGBUF_STANDARD);
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_MOVE_LEAFS);
PageSetLSN(current->page, recptr);
PageSetLSN(npage, recptr);
PageSetLSN(parent->page, recptr);
}
END_CRIT_SECTION();
/* Update local free-space cache and release new buffer */
SpGistSetLastUsedPage(index, nbuf);
UnlockReleaseBuffer(nbuf);
}
/*
* Update previously-created redirection tuple with appropriate destination
*
* We use this when it's not convenient to know the destination first.
* The tuple should have been made with the "impossible" destination of
* the metapage.
*/
static void
setRedirectionTuple(SPPageDesc *current, OffsetNumber position,
BlockNumber blkno, OffsetNumber offnum)
{
SpGistDeadTuple dt;
dt = (SpGistDeadTuple) PageGetItem(current->page,
PageGetItemId(current->page, position));
Assert(dt->tupstate == SPGIST_REDIRECT);
Assert(ItemPointerGetBlockNumber(&dt->pointer) == SPGIST_METAPAGE_BLKNO);
ItemPointerSet(&dt->pointer, blkno, offnum);
}
/*
* Test to see if the user-defined picksplit function failed to do its job,
* ie, it put all the leaf tuples into the same node.
* If so, randomly divide the tuples into several nodes (all with the same
* label) and return TRUE to select allTheSame mode for this inner tuple.
*
* (This code is also used to forcibly select allTheSame mode for nulls.)
*
* If we know that the leaf tuples wouldn't all fit on one page, then we
* exclude the last tuple (which is the incoming new tuple that forced a split)
* from the check to see if more than one node is used. The reason for this
* is that if the existing tuples are put into only one chain, then even if
* we move them all to an empty page, there would still not be room for the
* new tuple, so we'd get into an infinite loop of picksplit attempts.
* Forcing allTheSame mode dodges this problem by ensuring the old tuples will
* be split across pages. (Exercise for the reader: figure out why this
* fixes the problem even when there is only one old tuple.)
*/
static bool
checkAllTheSame(spgPickSplitIn *in, spgPickSplitOut *out, bool tooBig,
bool *includeNew)
{
int theNode;
int limit;
int i;
/* For the moment, assume we can include the new leaf tuple */
*includeNew = true;
/* If there's only the new leaf tuple, don't select allTheSame mode */
if (in->nTuples <= 1)
return false;
/* If tuple set doesn't fit on one page, ignore the new tuple in test */
limit = tooBig ? in->nTuples - 1 : in->nTuples;
/* Check to see if more than one node is populated */
theNode = out->mapTuplesToNodes[0];
for (i = 1; i < limit; i++)
{
if (out->mapTuplesToNodes[i] != theNode)
return false;
}
/* Nope, so override the picksplit function's decisions */
/* If the new tuple is in its own node, it can't be included in split */
if (tooBig && out->mapTuplesToNodes[in->nTuples - 1] != theNode)
*includeNew = false;
out->nNodes = 8; /* arbitrary number of child nodes */
/* Random assignment of tuples to nodes (note we include new tuple) */
for (i = 0; i < in->nTuples; i++)
out->mapTuplesToNodes[i] = i % out->nNodes;
/* The opclass may not use node labels, but if it does, duplicate 'em */
if (out->nodeLabels)
{
Datum theLabel = out->nodeLabels[theNode];
out->nodeLabels = (Datum *) palloc(sizeof(Datum) * out->nNodes);
for (i = 0; i < out->nNodes; i++)
out->nodeLabels[i] = theLabel;
}
/* We don't touch the prefix or the leaf tuple datum assignments */
return true;
}
/*
* current points to a leaf-tuple chain that we wanted to add newLeafTuple to,
* but the chain has to be split because there's not enough room to add
* newLeafTuple to its page.
*
* This function splits the leaf tuple set according to picksplit's rules,
* creating one or more new chains that are spread across the current page
* and an additional leaf page (we assume that two leaf pages will be
* sufficient). A new inner tuple is created, and the parent downlink
* pointer is updated to point to that inner tuple instead of the leaf chain.
*
* On exit, current contains the address of the new inner tuple.
*
* Returns true if we successfully inserted newLeafTuple during this function,
* false if caller still has to do it (meaning another picksplit operation is
* probably needed). Failure could occur if the picksplit result is fairly
* unbalanced, or if newLeafTuple is just plain too big to fit on a page.
* Because we force the picksplit result to be at least two chains, each
* cycle will get rid of at least one leaf tuple from the chain, so the loop
* will eventually terminate if lack of balance is the issue. If the tuple
* is too big, we assume that repeated picksplit operations will eventually
* make it small enough by repeated prefix-stripping. A broken opclass could
* make this an infinite loop, though.
*/
static bool
doPickSplit(Relation index, SpGistState *state,
SPPageDesc *current, SPPageDesc *parent,
SpGistLeafTuple newLeafTuple,
int level, bool isNulls, bool isNew)
{
bool insertedNew = false;
spgPickSplitIn in;
spgPickSplitOut out;
FmgrInfo *procinfo;
bool includeNew;
int i,
max,
n;
SpGistInnerTuple innerTuple;
SpGistNodeTuple node,
*nodes;
Buffer newInnerBuffer,
newLeafBuffer;
ItemPointerData *heapPtrs;
uint8 *leafPageSelect;
int *leafSizes;
OffsetNumber *toDelete;
OffsetNumber *toInsert;
OffsetNumber redirectTuplePos = InvalidOffsetNumber;
OffsetNumber startOffsets[2];
SpGistLeafTuple *newLeafs;
int spaceToDelete;
int currentFreeSpace;
int totalLeafSizes;
bool allTheSame;
spgxlogPickSplit xlrec;
char *leafdata,
*leafptr;
SPPageDesc saveCurrent;
int nToDelete,
nToInsert,
maxToInclude;
in.level = level;
/*
* Allocate per-leaf-tuple work arrays with max possible size
*/
max = PageGetMaxOffsetNumber(current->page);
n = max + 1;
in.datums = (Datum *) palloc(sizeof(Datum) * n);
heapPtrs = (ItemPointerData *) palloc(sizeof(ItemPointerData) * n);
toDelete = (OffsetNumber *) palloc(sizeof(OffsetNumber) * n);
toInsert = (OffsetNumber *) palloc(sizeof(OffsetNumber) * n);
newLeafs = (SpGistLeafTuple *) palloc(sizeof(SpGistLeafTuple) * n);
leafPageSelect = (uint8 *) palloc(sizeof(uint8) * n);
STORE_STATE(state, xlrec.stateSrc);
/*
* Form list of leaf tuples which will be distributed as split result;
* also, count up the amount of space that will be freed from current.
* (Note that in the non-root case, we won't actually delete the old
* tuples, only replace them with redirects or placeholders.)
*
* Note: the SGLTDATUM calls here are safe even when dealing with a nulls
* page. For a pass-by-value data type we will fetch a word that must
* exist even though it may contain garbage (because of the fact that leaf
* tuples must have size at least SGDTSIZE). For a pass-by-reference type
* we are just computing a pointer that isn't going to get dereferenced.
* So it's not worth guarding the calls with isNulls checks.
*/
nToInsert = 0;
nToDelete = 0;
spaceToDelete = 0;
if (SpGistBlockIsRoot(current->blkno))
{
/*
* We are splitting the root (which up to now is also a leaf page).
* Its tuples are not linked, so scan sequentially to get them all. We
* ignore the original value of current->offnum.
*/
for (i = FirstOffsetNumber; i <= max; i++)
{
SpGistLeafTuple it;
it = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, i));
if (it->tupstate == SPGIST_LIVE)
{
in.datums[nToInsert] = SGLTDATUM(it, state);
heapPtrs[nToInsert] = it->heapPtr;
nToInsert++;
toDelete[nToDelete] = i;
nToDelete++;
/* we will delete the tuple altogether, so count full space */
spaceToDelete += it->size + sizeof(ItemIdData);
}
else /* tuples on root should be live */
elog(ERROR, "unexpected SPGiST tuple state: %d", it->tupstate);
}
}
else
{
/* Normal case, just collect the leaf tuples in the chain */
i = current->offnum;
while (i != InvalidOffsetNumber)
{
SpGistLeafTuple it;
Assert(i >= FirstOffsetNumber && i <= max);
it = (SpGistLeafTuple) PageGetItem(current->page,
PageGetItemId(current->page, i));
if (it->tupstate == SPGIST_LIVE)
{
in.datums[nToInsert] = SGLTDATUM(it, state);
heapPtrs[nToInsert] = it->heapPtr;
nToInsert++;
toDelete[nToDelete] = i;
nToDelete++;
/* we will not delete the tuple, only replace with dead */
Assert(it->size >= SGDTSIZE);
spaceToDelete += it->size - SGDTSIZE;
}
else if (it->tupstate == SPGIST_DEAD)
{
/* We could see a DEAD tuple as first/only chain item */
Assert(i == current->offnum);
Assert(it->nextOffset == InvalidOffsetNumber);
toDelete[nToDelete] = i;
nToDelete++;
/* replacing it with redirect will save no space */
}
else
elog(ERROR, "unexpected SPGiST tuple state: %d", it->tupstate);
i = it->nextOffset;
}
}
in.nTuples = nToInsert;
/*
* We may not actually insert new tuple because another picksplit may be
* necessary due to too large value, but we will try to allocate enough
* space to include it; and in any case it has to be included in the input
* for the picksplit function. So don't increment nToInsert yet.
*/
in.datums[in.nTuples] = SGLTDATUM(newLeafTuple, state);
heapPtrs[in.nTuples] = newLeafTuple->heapPtr;
in.nTuples++;
memset(&out, 0, sizeof(out));
if (!isNulls)
{
/*
* Perform split using user-defined method.
*/
procinfo = index_getprocinfo(index, 1, SPGIST_PICKSPLIT_PROC);
FunctionCall2Coll(procinfo,
index->rd_indcollation[0],
PointerGetDatum(&in),
PointerGetDatum(&out));
/*
* Form new leaf tuples and count up the total space needed.
*/
totalLeafSizes = 0;
for (i = 0; i < in.nTuples; i++)
{
newLeafs[i] = spgFormLeafTuple(state, heapPtrs + i,
out.leafTupleDatums[i],
false);
totalLeafSizes += newLeafs[i]->size + sizeof(ItemIdData);
}
}
else
{
/*
* Perform dummy split that puts all tuples into one node.
* checkAllTheSame will override this and force allTheSame mode.
*/
out.hasPrefix = false;
out.nNodes = 1;
out.nodeLabels = NULL;
out.mapTuplesToNodes = palloc0(sizeof(int) * in.nTuples);
/*
* Form new leaf tuples and count up the total space needed.
*/
totalLeafSizes = 0;
for (i = 0; i < in.nTuples; i++)
{
newLeafs[i] = spgFormLeafTuple(state, heapPtrs + i,
(Datum) 0,
true);
totalLeafSizes += newLeafs[i]->size + sizeof(ItemIdData);
}
}
/*
* Check to see if the picksplit function failed to separate the values,
* ie, it put them all into the same child node. If so, select allTheSame
* mode and create a random split instead. See comments for
* checkAllTheSame as to why we need to know if the new leaf tuples could
* fit on one page.
*/
allTheSame = checkAllTheSame(&in, &out,
totalLeafSizes > SPGIST_PAGE_CAPACITY,
&includeNew);
/*
* If checkAllTheSame decided we must exclude the new tuple, don't
* consider it any further.
*/
if (includeNew)
maxToInclude = in.nTuples;
else
{
maxToInclude = in.nTuples - 1;
totalLeafSizes -= newLeafs[in.nTuples - 1]->size + sizeof(ItemIdData);
}
/*
* Allocate per-node work arrays. Since checkAllTheSame could replace
* out.nNodes with a value larger than the number of tuples on the input
* page, we can't allocate these arrays before here.
*/
nodes = (SpGistNodeTuple *) palloc(sizeof(SpGistNodeTuple) * out.nNodes);
leafSizes = (int *) palloc0(sizeof(int) * out.nNodes);
/*
* Form nodes of inner tuple and inner tuple itself
*/
for (i = 0; i < out.nNodes; i++)
{
Datum label = (Datum) 0;
bool labelisnull = (out.nodeLabels == NULL);
if (!labelisnull)
label = out.nodeLabels[i];
nodes[i] = spgFormNodeTuple(state, label, labelisnull);
}
innerTuple = spgFormInnerTuple(state,
out.hasPrefix, out.prefixDatum,
out.nNodes, nodes);
innerTuple->allTheSame = allTheSame;
/*
* Update nodes[] array to point into the newly formed innerTuple, so that
* we can adjust their downlinks below.
*/
SGITITERATE(innerTuple, i, node)
{
nodes[i] = node;
}
/*
* Re-scan new leaf tuples and count up the space needed under each node.
*/
for (i = 0; i < maxToInclude; i++)
{
n = out.mapTuplesToNodes[i];
if (n < 0 || n >= out.nNodes)
elog(ERROR, "inconsistent result of SPGiST picksplit function");
leafSizes[n] += newLeafs[i]->size + sizeof(ItemIdData);
}
/*
* To perform the split, we must insert a new inner tuple, which can't go
* on a leaf page; and unless we are splitting the root page, we must then
* update the parent tuple's downlink to point to the inner tuple. If
* there is room, we'll put the new inner tuple on the same page as the
* parent tuple, otherwise we need another non-leaf buffer. But if the
* parent page is the root, we can't add the new inner tuple there,
* because the root page must have only one inner tuple.
*/
xlrec.initInner = false;
if (parent->buffer != InvalidBuffer &&
!SpGistBlockIsRoot(parent->blkno) &&
(SpGistPageGetFreeSpace(parent->page, 1) >=
innerTuple->size + sizeof(ItemIdData)))
{
/* New inner tuple will fit on parent page */
newInnerBuffer = parent->buffer;
}
else if (parent->buffer != InvalidBuffer)
{
/* Send tuple to page with next triple parity (see README) */
newInnerBuffer = SpGistGetBuffer(index,
GBUF_INNER_PARITY(parent->blkno + 1) |
(isNulls ? GBUF_NULLS : 0),
innerTuple->size + sizeof(ItemIdData),
&xlrec.initInner);
}
else
{
/* Root page split ... inner tuple will go to root page */
newInnerBuffer = InvalidBuffer;
}
/*
* The new leaf tuples converted from the existing ones should require the
* same or less space, and therefore should all fit onto one page
* (although that's not necessarily the current page, since we can't
* delete the old tuples but only replace them with placeholders).
* However, the incoming new tuple might not also fit, in which case we
* might need another picksplit cycle to reduce it some more.
*
* If there's not room to put everything back onto the current page, then
* we decide on a per-node basis which tuples go to the new page. (We do
* it like that because leaf tuple chains can't cross pages, so we must
* place all leaf tuples belonging to the same parent node on the same
* page.)
*
* If we are splitting the root page (turning it from a leaf page into an
* inner page), then no leaf tuples can go back to the current page; they
* must all go somewhere else.
*/
if (!SpGistBlockIsRoot(current->blkno))
currentFreeSpace = PageGetExactFreeSpace(current->page) + spaceToDelete;
else
currentFreeSpace = 0; /* prevent assigning any tuples to current */
xlrec.initDest = false;
if (totalLeafSizes <= currentFreeSpace)
{
/* All the leaf tuples will fit on current page */
newLeafBuffer = InvalidBuffer;
/* mark new leaf tuple as included in insertions, if allowed */
if (includeNew)
{
nToInsert++;
insertedNew = true;
}
for (i = 0; i < nToInsert; i++)
leafPageSelect[i] = 0; /* signifies current page */
}
else if (in.nTuples == 1 && totalLeafSizes > SPGIST_PAGE_CAPACITY)
{
/*
* We're trying to split up a long value by repeated suffixing, but
* it's not going to fit yet. Don't bother allocating a second leaf
* buffer that we won't be able to use.
*/
newLeafBuffer = InvalidBuffer;
Assert(includeNew);
Assert(nToInsert == 0);
}
else
{
/* We will need another leaf page */
uint8 *nodePageSelect;
int curspace;
int newspace;
newLeafBuffer = SpGistGetBuffer(index,
GBUF_LEAF | (isNulls ? GBUF_NULLS : 0),
Min(totalLeafSizes,
SPGIST_PAGE_CAPACITY),
&xlrec.initDest);
/*
* Attempt to assign node groups to the two pages. We might fail to
* do so, even if totalLeafSizes is less than the available space,
* because we can't split a group across pages.
*/
nodePageSelect = (uint8 *) palloc(sizeof(uint8) * out.nNodes);
curspace = currentFreeSpace;
newspace = PageGetExactFreeSpace(BufferGetPage(newLeafBuffer));
for (i = 0; i < out.nNodes; i++)
{
if (leafSizes[i] <= curspace)
{
nodePageSelect[i] = 0; /* signifies current page */
curspace -= leafSizes[i];
}
else
{
nodePageSelect[i] = 1; /* signifies new leaf page */
newspace -= leafSizes[i];
}
}
if (curspace >= 0 && newspace >= 0)
{
/* Successful assignment, so we can include the new leaf tuple */
if (includeNew)
{
nToInsert++;
insertedNew = true;
}
}
else if (includeNew)
{
/* We must exclude the new leaf tuple from the split */
int nodeOfNewTuple = out.mapTuplesToNodes[in.nTuples - 1];
leafSizes[nodeOfNewTuple] -=
newLeafs[in.nTuples - 1]->size + sizeof(ItemIdData);
/* Repeat the node assignment process --- should succeed now */
curspace = currentFreeSpace;
newspace = PageGetExactFreeSpace(BufferGetPage(newLeafBuffer));
for (i = 0; i < out.nNodes; i++)
{
if (leafSizes[i] <= curspace)
{
nodePageSelect[i] = 0; /* signifies current page */
curspace -= leafSizes[i];
}
else
{
nodePageSelect[i] = 1; /* signifies new leaf page */
newspace -= leafSizes[i];
}
}
if (curspace < 0 || newspace < 0)
elog(ERROR, "failed to divide leaf tuple groups across pages");
}
else
{
/* oops, we already excluded new tuple ... should not get here */
elog(ERROR, "failed to divide leaf tuple groups across pages");
}
/* Expand the per-node assignments to be shown per leaf tuple */
for (i = 0; i < nToInsert; i++)
{
n = out.mapTuplesToNodes[i];
leafPageSelect[i] = nodePageSelect[n];
}
}
/* Start preparing WAL record */
xlrec.nDelete = 0;
xlrec.initSrc = isNew;
xlrec.storesNulls = isNulls;
xlrec.isRootSplit = SpGistBlockIsRoot(current->blkno);
leafdata = leafptr = (char *) palloc(totalLeafSizes);
/* Here we begin making the changes to the target pages */
START_CRIT_SECTION();
/*
* Delete old leaf tuples from current buffer, except when we're splitting
* the root; in that case there's no need because we'll re-init the page
* below. We do this first to make room for reinserting new leaf tuples.
*/
if (!SpGistBlockIsRoot(current->blkno))
{
/*
* Init buffer instead of deleting individual tuples, but only if
* there aren't any other live tuples and only during build; otherwise
* we need to set a redirection tuple for concurrent scans.
*/
if (state->isBuild &&
nToDelete + SpGistPageGetOpaque(current->page)->nPlaceholder ==
PageGetMaxOffsetNumber(current->page))
{
SpGistInitBuffer(current->buffer,
SPGIST_LEAF | (isNulls ? SPGIST_NULLS : 0));
xlrec.initSrc = true;
}
else if (isNew)
{
/* don't expose the freshly init'd buffer as a backup block */
Assert(nToDelete == 0);
}
else
{
xlrec.nDelete = nToDelete;
if (!state->isBuild)
{
/*
* Need to create redirect tuple (it will point to new inner
* tuple) but right now the new tuple's location is not known
* yet. So, set the redirection pointer to "impossible" value
* and remember its position to update tuple later.
*/
if (nToDelete > 0)
redirectTuplePos = toDelete[0];
spgPageIndexMultiDelete(state, current->page,
toDelete, nToDelete,
SPGIST_REDIRECT,
SPGIST_PLACEHOLDER,
SPGIST_METAPAGE_BLKNO,
FirstOffsetNumber);
}
else
{
/*
* During index build there is not concurrent searches, so we
* don't need to create redirection tuple.
*/
spgPageIndexMultiDelete(state, current->page,
toDelete, nToDelete,
SPGIST_PLACEHOLDER,
SPGIST_PLACEHOLDER,
InvalidBlockNumber,
InvalidOffsetNumber);
}
}
}
/*
* Put leaf tuples on proper pages, and update downlinks in innerTuple's
* nodes.
*/
startOffsets[0] = startOffsets[1] = InvalidOffsetNumber;
for (i = 0; i < nToInsert; i++)
{
SpGistLeafTuple it = newLeafs[i];
Buffer leafBuffer;
BlockNumber leafBlock;
OffsetNumber newoffset;
/* Which page is it going to? */
leafBuffer = leafPageSelect[i] ? newLeafBuffer : current->buffer;
leafBlock = BufferGetBlockNumber(leafBuffer);
/* Link tuple into correct chain for its node */
n = out.mapTuplesToNodes[i];
if (ItemPointerIsValid(&nodes[n]->t_tid))
{
Assert(ItemPointerGetBlockNumber(&nodes[n]->t_tid) == leafBlock);
it->nextOffset = ItemPointerGetOffsetNumber(&nodes[n]->t_tid);
}
else
it->nextOffset = InvalidOffsetNumber;
/* Insert it on page */
newoffset = SpGistPageAddNewItem(state, BufferGetPage(leafBuffer),
(Item) it, it->size,
&startOffsets[leafPageSelect[i]],
false);
toInsert[i] = newoffset;
/* ... and complete the chain linking */
ItemPointerSet(&nodes[n]->t_tid, leafBlock, newoffset);
/* Also copy leaf tuple into WAL data */
memcpy(leafptr, newLeafs[i], newLeafs[i]->size);
leafptr += newLeafs[i]->size;
}
/*
* We're done modifying the other leaf buffer (if any), so mark it dirty.
* current->buffer will be marked below, after we're entirely done
* modifying it.
*/
if (newLeafBuffer != InvalidBuffer)
{
MarkBufferDirty(newLeafBuffer);
}
/* Remember current buffer, since we're about to change "current" */
saveCurrent = *current;
/*
* Store the new innerTuple
*/
if (newInnerBuffer == parent->buffer && newInnerBuffer != InvalidBuffer)
{
/*
* new inner tuple goes to parent page
*/
Assert(current->buffer != parent->buffer);
/* Repoint "current" at the new inner tuple */
current->blkno = parent->blkno;
current->buffer = parent->buffer;
current->page = parent->page;
xlrec.offnumInner = current->offnum =
SpGistPageAddNewItem(state, current->page,
(Item) innerTuple, innerTuple->size,
NULL, false);
/*
* Update parent node link and mark parent page dirty
*/
xlrec.innerIsParent = true;
xlrec.offnumParent = parent->offnum;
xlrec.nodeI = parent->node;
saveNodeLink(index, parent, current->blkno, current->offnum);
/*
* Update redirection link (in old current buffer)
*/
if (redirectTuplePos != InvalidOffsetNumber)
setRedirectionTuple(&saveCurrent, redirectTuplePos,
current->blkno, current->offnum);
/* Done modifying old current buffer, mark it dirty */
MarkBufferDirty(saveCurrent.buffer);
}
else if (parent->buffer != InvalidBuffer)
{
/*
* new inner tuple will be stored on a new page
*/
Assert(newInnerBuffer != InvalidBuffer);
/* Repoint "current" at the new inner tuple */
current->buffer = newInnerBuffer;
current->blkno = BufferGetBlockNumber(current->buffer);
current->page = BufferGetPage(current->buffer);
xlrec.offnumInner = current->offnum =
SpGistPageAddNewItem(state, current->page,
(Item) innerTuple, innerTuple->size,
NULL, false);
/* Done modifying new current buffer, mark it dirty */
MarkBufferDirty(current->buffer);
/*
* Update parent node link and mark parent page dirty
*/
xlrec.innerIsParent = (parent->buffer == current->buffer);
xlrec.offnumParent = parent->offnum;
xlrec.nodeI = parent->node;
saveNodeLink(index, parent, current->blkno, current->offnum);
/*
* Update redirection link (in old current buffer)
*/
if (redirectTuplePos != InvalidOffsetNumber)
setRedirectionTuple(&saveCurrent, redirectTuplePos,
current->blkno, current->offnum);
/* Done modifying old current buffer, mark it dirty */
MarkBufferDirty(saveCurrent.buffer);
}
else
{
/*
* Splitting root page, which was a leaf but now becomes inner page
* (and so "current" continues to point at it)
*/
Assert(SpGistBlockIsRoot(current->blkno));
Assert(redirectTuplePos == InvalidOffsetNumber);
SpGistInitBuffer(current->buffer, (isNulls ? SPGIST_NULLS : 0));
xlrec.initInner = true;
xlrec.innerIsParent = false;
xlrec.offnumInner = current->offnum =
PageAddItem(current->page, (Item) innerTuple, innerTuple->size,
InvalidOffsetNumber, false, false);
if (current->offnum != FirstOffsetNumber)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
innerTuple->size);
/* No parent link to update, nor redirection to do */
xlrec.offnumParent = InvalidOffsetNumber;
xlrec.nodeI = 0;
/* Done modifying new current buffer, mark it dirty */
MarkBufferDirty(current->buffer);
/* saveCurrent doesn't represent a different buffer */
saveCurrent.buffer = InvalidBuffer;
}
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
int flags;
XLogBeginInsert();
xlrec.nInsert = nToInsert;
XLogRegisterData((char *) &xlrec, SizeOfSpgxlogPickSplit);
XLogRegisterData((char *) toDelete,
sizeof(OffsetNumber) * xlrec.nDelete);
XLogRegisterData((char *) toInsert,
sizeof(OffsetNumber) * xlrec.nInsert);
XLogRegisterData((char *) leafPageSelect,
sizeof(uint8) * xlrec.nInsert);
XLogRegisterData((char *) innerTuple, innerTuple->size);
XLogRegisterData(leafdata, leafptr - leafdata);
/* Old leaf page */
if (BufferIsValid(saveCurrent.buffer))
{
flags = REGBUF_STANDARD;
if (xlrec.initSrc)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(0, saveCurrent.buffer, flags);
}
/* New leaf page */
if (BufferIsValid(newLeafBuffer))
{
flags = REGBUF_STANDARD;
if (xlrec.initDest)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(1, newLeafBuffer, flags);
}
/* Inner page */
flags = REGBUF_STANDARD;
if (xlrec.initInner)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(2, current->buffer, flags);
/* Parent page, if different from inner page */
if (parent->buffer != InvalidBuffer)
{
if (parent->buffer != current->buffer)
XLogRegisterBuffer(3, parent->buffer, REGBUF_STANDARD);
else
Assert(xlrec.innerIsParent);
}
/* Issue the WAL record */
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_PICKSPLIT);
/* Update page LSNs on all affected pages */
if (newLeafBuffer != InvalidBuffer)
{
Page page = BufferGetPage(newLeafBuffer);
PageSetLSN(page, recptr);
}
if (saveCurrent.buffer != InvalidBuffer)
{
Page page = BufferGetPage(saveCurrent.buffer);
PageSetLSN(page, recptr);
}
PageSetLSN(current->page, recptr);
if (parent->buffer != InvalidBuffer)
{
PageSetLSN(parent->page, recptr);
}
}
END_CRIT_SECTION();
/* Update local free-space cache and unlock buffers */
if (newLeafBuffer != InvalidBuffer)
{
SpGistSetLastUsedPage(index, newLeafBuffer);
UnlockReleaseBuffer(newLeafBuffer);
}
if (saveCurrent.buffer != InvalidBuffer)
{
SpGistSetLastUsedPage(index, saveCurrent.buffer);
UnlockReleaseBuffer(saveCurrent.buffer);
}
return insertedNew;
}
/*
* spgMatchNode action: descend to N'th child node of current inner tuple
*/
static void
spgMatchNodeAction(Relation index, SpGistState *state,
SpGistInnerTuple innerTuple,
SPPageDesc *current, SPPageDesc *parent, int nodeN)
{
int i;
SpGistNodeTuple node;
/* Release previous parent buffer if any */
if (parent->buffer != InvalidBuffer &&
parent->buffer != current->buffer)
{
SpGistSetLastUsedPage(index, parent->buffer);
UnlockReleaseBuffer(parent->buffer);
}
/* Repoint parent to specified node of current inner tuple */
parent->blkno = current->blkno;
parent->buffer = current->buffer;
parent->page = current->page;
parent->offnum = current->offnum;
parent->node = nodeN;
/* Locate that node */
SGITITERATE(innerTuple, i, node)
{
if (i == nodeN)
break;
}
if (i != nodeN)
elog(ERROR, "failed to find requested node %d in SPGiST inner tuple",
nodeN);
/* Point current to the downlink location, if any */
if (ItemPointerIsValid(&node->t_tid))
{
current->blkno = ItemPointerGetBlockNumber(&node->t_tid);
current->offnum = ItemPointerGetOffsetNumber(&node->t_tid);
}
else
{
/* Downlink is empty, so we'll need to find a new page */
current->blkno = InvalidBlockNumber;
current->offnum = InvalidOffsetNumber;
}
current->buffer = InvalidBuffer;
current->page = NULL;
}
/*
* spgAddNode action: add a node to the inner tuple at current
*/
static void
spgAddNodeAction(Relation index, SpGistState *state,
SpGistInnerTuple innerTuple,
SPPageDesc *current, SPPageDesc *parent,
int nodeN, Datum nodeLabel)
{
SpGistInnerTuple newInnerTuple;
spgxlogAddNode xlrec;
/* Should not be applied to nulls */
Assert(!SpGistPageStoresNulls(current->page));
/* Construct new inner tuple with additional node */
newInnerTuple = addNode(state, innerTuple, nodeLabel, nodeN);
/* Prepare WAL record */
STORE_STATE(state, xlrec.stateSrc);
xlrec.offnum = current->offnum;
/* we don't fill these unless we need to change the parent downlink */
xlrec.parentBlk = -1;
xlrec.offnumParent = InvalidOffsetNumber;
xlrec.nodeI = 0;
/* we don't fill these unless tuple has to be moved */
xlrec.offnumNew = InvalidOffsetNumber;
xlrec.newPage = false;
if (PageGetExactFreeSpace(current->page) >=
newInnerTuple->size - innerTuple->size)
{
/*
* We can replace the inner tuple by new version in-place
*/
START_CRIT_SECTION();
PageIndexTupleDelete(current->page, current->offnum);
if (PageAddItem(current->page,
(Item) newInnerTuple, newInnerTuple->size,
current->offnum, false, false) != current->offnum)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
newInnerTuple->size);
MarkBufferDirty(current->buffer);
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
XLogRegisterData((char *) newInnerTuple, newInnerTuple->size);
XLogRegisterBuffer(0, current->buffer, REGBUF_STANDARD);
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_NODE);
PageSetLSN(current->page, recptr);
}
END_CRIT_SECTION();
}
else
{
/*
* move inner tuple to another page, and update parent
*/
SpGistDeadTuple dt;
SPPageDesc saveCurrent;
/*
* It should not be possible to get here for the root page, since we
* allow only one inner tuple on the root page, and spgFormInnerTuple
* always checks that inner tuples don't exceed the size of a page.
*/
if (SpGistBlockIsRoot(current->blkno))
elog(ERROR, "cannot enlarge root tuple any more");
Assert(parent->buffer != InvalidBuffer);
saveCurrent = *current;
xlrec.offnumParent = parent->offnum;
xlrec.nodeI = parent->node;
/*
* obtain new buffer with the same parity as current, since it will be
* a child of same parent tuple
*/
current->buffer = SpGistGetBuffer(index,
GBUF_INNER_PARITY(current->blkno),
newInnerTuple->size + sizeof(ItemIdData),
&xlrec.newPage);
current->blkno = BufferGetBlockNumber(current->buffer);
current->page = BufferGetPage(current->buffer);
/*
* Let's just make real sure new current isn't same as old. Right now
* that's impossible, but if SpGistGetBuffer ever got smart enough to
* delete placeholder tuples before checking space, maybe it wouldn't
* be impossible. The case would appear to work except that WAL
* replay would be subtly wrong, so I think a mere assert isn't enough
* here.
*/
if (current->blkno == saveCurrent.blkno)
elog(ERROR, "SPGiST new buffer shouldn't be same as old buffer");
/*
* New current and parent buffer will both be modified; but note that
* parent buffer could be same as either new or old current.
*/
if (parent->buffer == saveCurrent.buffer)
xlrec.parentBlk = 0;
else if (parent->buffer == current->buffer)
xlrec.parentBlk = 1;
else
xlrec.parentBlk = 2;
START_CRIT_SECTION();
/* insert new ... */
xlrec.offnumNew = current->offnum =
SpGistPageAddNewItem(state, current->page,
(Item) newInnerTuple, newInnerTuple->size,
NULL, false);
MarkBufferDirty(current->buffer);
/* update parent's downlink and mark parent page dirty */
saveNodeLink(index, parent, current->blkno, current->offnum);
/*
* Replace old tuple with a placeholder or redirection tuple. Unless
* doing an index build, we have to insert a redirection tuple for
* possible concurrent scans. We can't just delete it in any case,
* because that could change the offsets of other tuples on the page,
* breaking downlinks from their parents.
*/
if (state->isBuild)
dt = spgFormDeadTuple(state, SPGIST_PLACEHOLDER,
InvalidBlockNumber, InvalidOffsetNumber);
else
dt = spgFormDeadTuple(state, SPGIST_REDIRECT,
current->blkno, current->offnum);
PageIndexTupleDelete(saveCurrent.page, saveCurrent.offnum);
if (PageAddItem(saveCurrent.page, (Item) dt, dt->size,
saveCurrent.offnum,
false, false) != saveCurrent.offnum)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
dt->size);
if (state->isBuild)
SpGistPageGetOpaque(saveCurrent.page)->nPlaceholder++;
else
SpGistPageGetOpaque(saveCurrent.page)->nRedirection++;
MarkBufferDirty(saveCurrent.buffer);
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
int flags;
XLogBeginInsert();
/* orig page */
XLogRegisterBuffer(0, saveCurrent.buffer, REGBUF_STANDARD);
/* new page */
flags = REGBUF_STANDARD;
if (xlrec.newPage)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(1, current->buffer, flags);
/* parent page (if different from orig and new) */
if (xlrec.parentBlk == 2)
XLogRegisterBuffer(2, parent->buffer, REGBUF_STANDARD);
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
XLogRegisterData((char *) newInnerTuple, newInnerTuple->size);
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_NODE);
/* we don't bother to check if any of these are redundant */
PageSetLSN(current->page, recptr);
PageSetLSN(parent->page, recptr);
PageSetLSN(saveCurrent.page, recptr);
}
END_CRIT_SECTION();
/* Release saveCurrent if it's not same as current or parent */
if (saveCurrent.buffer != current->buffer &&
saveCurrent.buffer != parent->buffer)
{
SpGistSetLastUsedPage(index, saveCurrent.buffer);
UnlockReleaseBuffer(saveCurrent.buffer);
}
}
}
/*
* spgSplitNode action: split inner tuple at current into prefix and postfix
*/
static void
spgSplitNodeAction(Relation index, SpGistState *state,
SpGistInnerTuple innerTuple,
SPPageDesc *current, spgChooseOut *out)
{
SpGistInnerTuple prefixTuple,
postfixTuple;
SpGistNodeTuple node,
*nodes;
BlockNumber postfixBlkno;
OffsetNumber postfixOffset;
int i;
spgxlogSplitTuple xlrec;
Buffer newBuffer = InvalidBuffer;
/* Should not be applied to nulls */
Assert(!SpGistPageStoresNulls(current->page));
/*
* Construct new prefix tuple, containing a single node with the specified
* label. (We'll update the node's downlink to point to the new postfix
* tuple, below.)
*/
node = spgFormNodeTuple(state, out->result.splitTuple.nodeLabel, false);
prefixTuple = spgFormInnerTuple(state,
out->result.splitTuple.prefixHasPrefix,
out->result.splitTuple.prefixPrefixDatum,
1, &node);
/* it must fit in the space that innerTuple now occupies */
if (prefixTuple->size > innerTuple->size)
elog(ERROR, "SPGiST inner-tuple split must not produce longer prefix");
/*
* Construct new postfix tuple, containing all nodes of innerTuple with
* same node datums, but with the prefix specified by the picksplit
* function.
*/
nodes = palloc(sizeof(SpGistNodeTuple) * innerTuple->nNodes);
SGITITERATE(innerTuple, i, node)
{
nodes[i] = node;
}
postfixTuple = spgFormInnerTuple(state,
out->result.splitTuple.postfixHasPrefix,
out->result.splitTuple.postfixPrefixDatum,
innerTuple->nNodes, nodes);
/* Postfix tuple is allTheSame if original tuple was */
postfixTuple->allTheSame = innerTuple->allTheSame;
/* prep data for WAL record */
xlrec.newPage = false;
/*
* If we can't fit both tuples on the current page, get a new page for the
* postfix tuple. In particular, can't split to the root page.
*
* For the space calculation, note that prefixTuple replaces innerTuple
* but postfixTuple will be a new entry.
*/
if (SpGistBlockIsRoot(current->blkno) ||
SpGistPageGetFreeSpace(current->page, 1) + innerTuple->size <
prefixTuple->size + postfixTuple->size + sizeof(ItemIdData))
{
/*
* Choose page with next triple parity, because postfix tuple is a
* child of prefix one
*/
newBuffer = SpGistGetBuffer(index,
GBUF_INNER_PARITY(current->blkno + 1),
postfixTuple->size + sizeof(ItemIdData),
&xlrec.newPage);
}
START_CRIT_SECTION();
/*
* Replace old tuple by prefix tuple
*/
PageIndexTupleDelete(current->page, current->offnum);
xlrec.offnumPrefix = PageAddItem(current->page,
(Item) prefixTuple, prefixTuple->size,
current->offnum, false, false);
if (xlrec.offnumPrefix != current->offnum)
elog(ERROR, "failed to add item of size %u to SPGiST index page",
prefixTuple->size);
/*
* put postfix tuple into appropriate page
*/
if (newBuffer == InvalidBuffer)
{
postfixBlkno = current->blkno;
xlrec.offnumPostfix = postfixOffset =
SpGistPageAddNewItem(state, current->page,
(Item) postfixTuple, postfixTuple->size,
NULL, false);
xlrec.postfixBlkSame = true;
}
else
{
postfixBlkno = BufferGetBlockNumber(newBuffer);
xlrec.offnumPostfix = postfixOffset =
SpGistPageAddNewItem(state, BufferGetPage(newBuffer),
(Item) postfixTuple, postfixTuple->size,
NULL, false);
MarkBufferDirty(newBuffer);
xlrec.postfixBlkSame = false;
}
/*
* And set downlink pointer in the prefix tuple to point to postfix tuple.
* (We can't avoid this step by doing the above two steps in opposite
* order, because there might not be enough space on the page to insert
* the postfix tuple first.) We have to update the local copy of the
* prefixTuple too, because that's what will be written to WAL.
*/
spgUpdateNodeLink(prefixTuple, 0, postfixBlkno, postfixOffset);
prefixTuple = (SpGistInnerTuple) PageGetItem(current->page,
PageGetItemId(current->page, current->offnum));
spgUpdateNodeLink(prefixTuple, 0, postfixBlkno, postfixOffset);
MarkBufferDirty(current->buffer);
if (RelationNeedsWAL(index))
{
XLogRecPtr recptr;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
XLogRegisterData((char *) prefixTuple, prefixTuple->size);
XLogRegisterData((char *) postfixTuple, postfixTuple->size);
XLogRegisterBuffer(0, current->buffer, REGBUF_STANDARD);
if (newBuffer != InvalidBuffer)
{
int flags;
flags = REGBUF_STANDARD;
if (xlrec.newPage)
flags |= REGBUF_WILL_INIT;
XLogRegisterBuffer(1, newBuffer, flags);
}
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_SPLIT_TUPLE);
PageSetLSN(current->page, recptr);
if (newBuffer != InvalidBuffer)
{
PageSetLSN(BufferGetPage(newBuffer), recptr);
}
}
END_CRIT_SECTION();
/* Update local free-space cache and release buffer */
if (newBuffer != InvalidBuffer)
{
SpGistSetLastUsedPage(index, newBuffer);
UnlockReleaseBuffer(newBuffer);
}
}
/*
* Insert one item into the index.
*
* Returns true on success, false if we failed to complete the insertion
* because of conflict with a concurrent insert. In the latter case,
* caller should re-call spgdoinsert() with the same args.
*/
bool
spgdoinsert(Relation index, SpGistState *state,
ItemPointer heapPtr, Datum datum, bool isnull)
{
int level = 0;
Datum leafDatum;
int leafSize;
SPPageDesc current,
parent;
FmgrInfo *procinfo = NULL;
/*
* Look up FmgrInfo of the user-defined choose function once, to save
* cycles in the loop below.
*/
if (!isnull)
procinfo = index_getprocinfo(index, 1, SPGIST_CHOOSE_PROC);
/*
* Since we don't use index_form_tuple in this AM, we have to make sure
* value to be inserted is not toasted; FormIndexDatum doesn't guarantee
* that.
*/
if (!isnull && state->attType.attlen == -1)
datum = PointerGetDatum(PG_DETOAST_DATUM(datum));
leafDatum = datum;
/*
* Compute space needed for a leaf tuple containing the given datum.
*
* If it isn't gonna fit, and the opclass can't reduce the datum size by
* suffixing, bail out now rather than getting into an endless loop.
*/
if (!isnull)
leafSize = SGLTHDRSZ + sizeof(ItemIdData) +
SpGistGetTypeSize(&state->attType, leafDatum);
else
leafSize = SGDTSIZE + sizeof(ItemIdData);
if (leafSize > SPGIST_PAGE_CAPACITY && !state->config.longValuesOK)
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
leafSize - sizeof(ItemIdData),
SPGIST_PAGE_CAPACITY - sizeof(ItemIdData),
RelationGetRelationName(index)),
errhint("Values larger than a buffer page cannot be indexed.")));
/* Initialize "current" to the appropriate root page */
current.blkno = isnull ? SPGIST_NULL_BLKNO : SPGIST_ROOT_BLKNO;
current.buffer = InvalidBuffer;
current.page = NULL;
current.offnum = FirstOffsetNumber;
current.node = -1;
/* "parent" is invalid for the moment */
parent.blkno = InvalidBlockNumber;
parent.buffer = InvalidBuffer;
parent.page = NULL;
parent.offnum = InvalidOffsetNumber;
parent.node = -1;
for (;;)
{
bool isNew = false;
/*
* Bail out if query cancel is pending. We must have this somewhere
* in the loop since a broken opclass could produce an infinite
* picksplit loop.
*/
CHECK_FOR_INTERRUPTS();
if (current.blkno == InvalidBlockNumber)
{
/*
* Create a leaf page. If leafSize is too large to fit on a page,
* we won't actually use the page yet, but it simplifies the API
* for doPickSplit to always have a leaf page at hand; so just
* quietly limit our request to a page size.
*/
current.buffer =
SpGistGetBuffer(index,
GBUF_LEAF | (isnull ? GBUF_NULLS : 0),
Min(leafSize, SPGIST_PAGE_CAPACITY),
&isNew);
current.blkno = BufferGetBlockNumber(current.buffer);
}
else if (parent.buffer == InvalidBuffer)
{
/* we hold no parent-page lock, so no deadlock is possible */
current.buffer = ReadBuffer(index, current.blkno);
LockBuffer(current.buffer, BUFFER_LOCK_EXCLUSIVE);
}
else if (current.blkno != parent.blkno)
{
/* descend to a new child page */
current.buffer = ReadBuffer(index, current.blkno);
/*
* Attempt to acquire lock on child page. We must beware of
* deadlock against another insertion process descending from that
* page to our parent page (see README). If we fail to get lock,
* abandon the insertion and tell our caller to start over.
*
* XXX this could be improved, because failing to get lock on a
* buffer is not proof of a deadlock situation; the lock might be
* held by a reader, or even just background writer/checkpointer
* process. Perhaps it'd be worth retrying after sleeping a bit?
*/
if (!ConditionalLockBuffer(current.buffer))
{
ReleaseBuffer(current.buffer);
UnlockReleaseBuffer(parent.buffer);
return false;
}
}
else
{
/* inner tuple can be stored on the same page as parent one */
current.buffer = parent.buffer;
}
current.page = BufferGetPage(current.buffer);
/* should not arrive at a page of the wrong type */
if (isnull ? !SpGistPageStoresNulls(current.page) :
SpGistPageStoresNulls(current.page))
elog(ERROR, "SPGiST index page %u has wrong nulls flag",
current.blkno);
if (SpGistPageIsLeaf(current.page))
{
SpGistLeafTuple leafTuple;
int nToSplit,
sizeToSplit;
leafTuple = spgFormLeafTuple(state, heapPtr, leafDatum, isnull);
if (leafTuple->size + sizeof(ItemIdData) <=
SpGistPageGetFreeSpace(current.page, 1))
{
/* it fits on page, so insert it and we're done */
addLeafTuple(index, state, leafTuple,
&current, &parent, isnull, isNew);
break;
}
else if ((sizeToSplit =
checkSplitConditions(index, state, &current,
&nToSplit)) < SPGIST_PAGE_CAPACITY / 2 &&
nToSplit < 64 &&
leafTuple->size + sizeof(ItemIdData) + sizeToSplit <= SPGIST_PAGE_CAPACITY)
{
/*
* the amount of data is pretty small, so just move the whole
* chain to another leaf page rather than splitting it.
*/
Assert(!isNew);
moveLeafs(index, state, &current, &parent, leafTuple, isnull);
break; /* we're done */
}
else
{
/* picksplit */
if (doPickSplit(index, state, &current, &parent,
leafTuple, level, isnull, isNew))
break; /* doPickSplit installed new tuples */
/* leaf tuple will not be inserted yet */
pfree(leafTuple);
/*
* current now describes new inner tuple, go insert into it
*/
Assert(!SpGistPageIsLeaf(current.page));
goto process_inner_tuple;
}
}
else /* non-leaf page */
{
/*
* Apply the opclass choose function to figure out how to insert
* the given datum into the current inner tuple.
*/
SpGistInnerTuple innerTuple;
spgChooseIn in;
spgChooseOut out;
/*
* spgAddNode and spgSplitTuple cases will loop back to here to
* complete the insertion operation. Just in case the choose
* function is broken and produces add or split requests
* repeatedly, check for query cancel.
*/
process_inner_tuple:
CHECK_FOR_INTERRUPTS();
innerTuple = (SpGistInnerTuple) PageGetItem(current.page,
PageGetItemId(current.page, current.offnum));
in.datum = datum;
in.leafDatum = leafDatum;
in.level = level;
in.allTheSame = innerTuple->allTheSame;
in.hasPrefix = (innerTuple->prefixSize > 0);
in.prefixDatum = SGITDATUM(innerTuple, state);
in.nNodes = innerTuple->nNodes;
in.nodeLabels = spgExtractNodeLabels(state, innerTuple);
memset(&out, 0, sizeof(out));
if (!isnull)
{
/* use user-defined choose method */
FunctionCall2Coll(procinfo,
index->rd_indcollation[0],
PointerGetDatum(&in),
PointerGetDatum(&out));
}
else
{
/* force "match" action (to insert to random subnode) */
out.resultType = spgMatchNode;
}
if (innerTuple->allTheSame)
{
/*
* It's not allowed to do an AddNode at an allTheSame tuple.
* Opclass must say "match", in which case we choose a random
* one of the nodes to descend into, or "split".
*/
if (out.resultType == spgAddNode)
elog(ERROR, "cannot add a node to an allTheSame inner tuple");
else if (out.resultType == spgMatchNode)
out.result.matchNode.nodeN = random() % innerTuple->nNodes;
}
switch (out.resultType)
{
case spgMatchNode:
/* Descend to N'th child node */
spgMatchNodeAction(index, state, innerTuple,
&current, &parent,
out.result.matchNode.nodeN);
/* Adjust level as per opclass request */
level += out.result.matchNode.levelAdd;
/* Replace leafDatum and recompute leafSize */
if (!isnull)
{
leafDatum = out.result.matchNode.restDatum;
leafSize = SGLTHDRSZ + sizeof(ItemIdData) +
SpGistGetTypeSize(&state->attType, leafDatum);
}
/*
* Loop around and attempt to insert the new leafDatum at
* "current" (which might reference an existing child
* tuple, or might be invalid to force us to find a new
* page for the tuple).
*
* Note: if the opclass sets longValuesOK, we rely on the
* choose function to eventually shorten the leafDatum
* enough to fit on a page. We could add a test here to
* complain if the datum doesn't get visibly shorter each
* time, but that could get in the way of opclasses that
* "simplify" datums in a way that doesn't necessarily
* lead to physical shortening on every cycle.
*/
break;
case spgAddNode:
/* AddNode is not sensible if nodes don't have labels */
if (in.nodeLabels == NULL)
elog(ERROR, "cannot add a node to an inner tuple without node labels");
/* Add node to inner tuple, per request */
spgAddNodeAction(index, state, innerTuple,
&current, &parent,
out.result.addNode.nodeN,
out.result.addNode.nodeLabel);
/*
* Retry insertion into the enlarged node. We assume that
* we'll get a MatchNode result this time.
*/
goto process_inner_tuple;
break;
case spgSplitTuple:
/* Split inner tuple, per request */
spgSplitNodeAction(index, state, innerTuple,
&current, &out);
/* Retry insertion into the split node */
goto process_inner_tuple;
break;
default:
elog(ERROR, "unrecognized SPGiST choose result: %d",
(int) out.resultType);
break;
}
}
} /* end loop */
/*
* Release any buffers we're still holding. Beware of possibility that
* current and parent reference same buffer.
*/
if (current.buffer != InvalidBuffer)
{
SpGistSetLastUsedPage(index, current.buffer);
UnlockReleaseBuffer(current.buffer);
}
if (parent.buffer != InvalidBuffer &&
parent.buffer != current.buffer)
{
SpGistSetLastUsedPage(index, parent.buffer);
UnlockReleaseBuffer(parent.buffer);
}
return true;
}
# Crash reproducer for clang version 5.0.0 (https://github.com/CTSRD-CHERI/clang.git 520ebe16e7f8f96ccf30266dbab8d7d27c27f64d) (https://github.com/CTSRD-CHERI/llvm.git db1cf1fff6307cb2da2aa990cb1bc85bf0a171f3)
# Driver args: "-Wall" "-Wmissing-prototypes" "-Wpointer-arith" "-Wdeclaration-after-statement" "-Wendif-labels" "-Wmissing-format-attribute" "-Wformat-security" "-fno-strict-aliasing" "-fwrapv" "-Wno-unused-command-line-argument" "-pipe" "--sysroot=/home/en322/cheri/output/sdk256/sysroot" "-B" "/home/en322/cheri/output/sdk256/bin" "--target=cheri-unknown-freebsd" "-mabi=purecap" "-msoft-float" "-O0" "-ggdb" "-static" "-fintegrated-as" "-isystem" "/home/en322/cheri/output/sdk256/sysroot/usr/include/edit/" "-Werror=cheri-capability-misuse" "-Werror=implicit-function-declaration" "-Werror=format" "-Werror=undefined-internal" "-Werror=incompatible-pointer-types" "-I" "../../../../src/include" "-pipe" "--sysroot=/home/en322/cheri/output/sdk256/sysroot" "-B" "/home/en322/cheri/output/sdk256/bin" "--target=cheri-unknown-freebsd" "-mabi=purecap" "-msoft-float" "-O0" "-ggdb" "-static" "-fintegrated-as" "-c" "-o" "spgdoinsert.o" "spgdoinsert.c"
# Original command: "/usr/home/en322/cheri/output/sdk256/bin/clang-5.0" "-cc1" "-triple" "cheri-unknown-freebsd" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "spgdoinsert.c" "-static-define" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-relaxed-aliasing" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "cheri" "-target-feature" "+soft-float" "-target-abi" "purecap" "-Wmips-cheri-prototypes" "-msoft-float" "-mfloat-abi" "soft" "-dwarf-column-info" "-debug-info-kind=standalone" "-dwarf-version=2" "-debugger-tuning=gdb" "-coverage-notes-file" "/usr/home/en322/cheri/postgres/src/backend/access/spgist/spgdoinsert.gcno" "-resource-dir" "/usr/home/en322/cheri/output/sdk256/lib/clang/5.0.0" "-isystem" "/home/en322/cheri/output/sdk256/sysroot/usr/include/edit/" "-I" "../../../../src/include" "-isysroot" "/home/en322/cheri/output/sdk256/sysroot" "-O0" "-Wall" "-Wmissing-prototypes" "-Wpointer-arith" "-Wdeclaration-after-statement" "-Wendif-labels" "-Wmissing-format-attribute" "-Wformat-security" "-Wno-unused-command-line-argument" "-Werror=cheri-capability-misuse" "-Werror=implicit-function-declaration" "-Werror=format" "-Werror=undefined-internal" "-Werror=incompatible-pointer-types" "-fdebug-compilation-dir" "/usr/home/en322/cheri/postgres/src/backend/access/spgist" "-ferror-limit" "19" "-fmessage-length" "238" "-fwrapv" "-fobjc-runtime=gnustep" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-cheri-linker" "-o" "spgdoinsert.o" "-x" "c" "spgdoinsert.c"
"/usr/home/en322/cheri/output/sdk256/bin/clang-5.0" "-cc1" "-triple" "cheri-unknown-freebsd" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "spgdoinsert.c" "-static-define" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-relaxed-aliasing" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "cheri" "-target-feature" "+soft-float" "-target-abi" "purecap" "-Wmips-cheri-prototypes" "-msoft-float" "-mfloat-abi" "soft" "-dwarf-column-info" "-debug-info-kind=standalone" "-dwarf-version=2" "-debugger-tuning=gdb" "-coverage-notes-file" "/usr/home/en322/cheri/postgres/src/backend/access/spgist/spgdoinsert.gcno" "-O0" "-Wall" "-Wmissing-prototypes" "-Wpointer-arith" "-Wdeclaration-after-statement" "-Wendif-labels" "-Wmissing-format-attribute" "-Wformat-security" "-Wno-unused-command-line-argument" "-Werror=cheri-capability-misuse" "-Werror=implicit-function-declaration" "-Werror=format" "-Werror=undefined-internal" "-Werror=incompatible-pointer-types" "-ferror-limit" "19" "-fmessage-length" "238" "-fwrapv" "-fobjc-runtime=gnustep" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-cheri-linker" "-x" "c" "spgdoinsert-0dc1fc.c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment