2017-09-30 16:44:03 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
C to Perl Interface
|
|
|
|
|
|
|
|
The following C types are mapped by the current typemap:
|
|
|
|
|
|
|
|
'AV *', 'Boolean', 'CV *', 'FILE *', 'FileHandle', 'HV *', 'I16', 'I32', 'I8', 'IV', 'InOutStream', 'InputStream', 'NV',
|
|
|
|
'OutputStream', 'PerlIO *', 'Result', 'STRLEN', 'SV *', 'SVREF', 'SysRet', 'SysRetLong', 'Time_t *', 'U16', 'U32', 'U8', 'UV',
|
|
|
|
'bool', 'bool_t', 'caddr_t', 'char', 'char *', 'char **', 'const char *', 'double', 'float', 'int', 'long', 'short', 'size_t',
|
|
|
|
'ssize_t', 'time_t', 'unsigned', 'unsigned char', 'unsigned char *', 'unsigned int', 'unsigned long', 'unsigned long *',
|
|
|
|
'unsigned short', 'void *', 'wchar_t', 'wchar_t *'
|
|
|
|
***********************************************************************************************************************************/
|
2019-04-26 14:08:23 +02:00
|
|
|
#include "build.auto.h"
|
|
|
|
|
2016-12-13 01:54:07 +02:00
|
|
|
#define PERL_NO_GET_CONTEXT
|
|
|
|
|
2017-09-30 16:44:03 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Perl includes
|
|
|
|
|
|
|
|
Order is critical here so don't change it.
|
|
|
|
***********************************************************************************************************************************/
|
2017-11-07 05:55:34 +02:00
|
|
|
#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 8 || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ >= 0)))
|
|
|
|
#define WARNING_MAYBE_INITIALIZED 1
|
|
|
|
#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ >= 0)))
|
|
|
|
#define WARNING_INITIALIZED 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if WARNING_MAYBE_INITIALIZED
|
|
|
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
|
|
#elif WARNING_INITIALIZED
|
|
|
|
#pragma GCC diagnostic ignored "-Wuninitialized"
|
|
|
|
#endif
|
|
|
|
|
2018-05-22 18:53:08 +02:00
|
|
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
|
|
|
#pragma GCC diagnostic ignored "-Wconversion"
|
|
|
|
|
2017-09-30 16:44:03 +02:00
|
|
|
#include <XSUB.h>
|
|
|
|
#include <EXTERN.h>
|
|
|
|
#include <perl.h>
|
2016-12-13 01:54:07 +02:00
|
|
|
|
2018-05-22 18:53:08 +02:00
|
|
|
#if WARNING_MAYBE_INITIALIZED
|
|
|
|
#pragma GCC diagnostic warning "-Wmaybe-uninitialized"
|
|
|
|
#elif WARNING_INITIALIZED
|
|
|
|
#pragma GCC diagnostic warning "-Wuninitialized"
|
2017-11-07 05:55:34 +02:00
|
|
|
#endif
|
|
|
|
|
2017-09-30 16:44:03 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
C includes
|
|
|
|
|
|
|
|
These includes are from the src directory. There is no Perl-specific code in them.
|
|
|
|
***********************************************************************************************************************************/
|
2019-03-10 13:27:30 +02:00
|
|
|
#include "common/crypto/common.h"
|
2017-10-16 16:09:56 +02:00
|
|
|
#include "common/error.h"
|
2018-04-11 15:36:12 +02:00
|
|
|
#include "common/lock.h"
|
2017-09-30 16:44:03 +02:00
|
|
|
#include "config/config.h"
|
2017-11-02 14:14:13 +02:00
|
|
|
#include "config/define.h"
|
2018-02-05 19:32:30 +02:00
|
|
|
#include "config/load.h"
|
2018-04-13 22:05:52 +02:00
|
|
|
#include "config/parse.h"
|
2018-02-14 16:49:01 +02:00
|
|
|
#include "perl/config.h"
|
2017-09-30 16:44:03 +02:00
|
|
|
#include "postgres/pageChecksum.h"
|
2018-09-14 00:58:22 +02:00
|
|
|
#include "storage/driver/posix/storage.h"
|
2017-09-30 16:44:03 +02:00
|
|
|
|
2017-10-16 16:47:31 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Helper macros
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
#include "LibC.h"
|
|
|
|
|
2017-10-18 17:14:26 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
XSH includes
|
|
|
|
|
|
|
|
These includes define data structures that are required for the C to Perl interface but are not part of the regular C source.
|
|
|
|
***********************************************************************************************************************************/
|
2018-06-11 16:53:16 +02:00
|
|
|
#include "xs/crypto/cipherBlock.xsh"
|
2018-06-11 20:52:26 +02:00
|
|
|
#include "xs/crypto/hash.xsh"
|
2017-10-18 17:14:26 +02:00
|
|
|
#include "xs/common/encode.xsh"
|
2017-11-07 05:55:34 +02:00
|
|
|
|
2017-09-30 16:44:03 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Module definition
|
|
|
|
***********************************************************************************************************************************/
|
2017-08-25 22:47:47 +02:00
|
|
|
MODULE = pgBackRest::LibC PACKAGE = pgBackRest::LibC
|
|
|
|
PROTOTYPES: DISABLE
|
2016-12-13 01:54:07 +02:00
|
|
|
|
2018-05-22 18:53:08 +02:00
|
|
|
# Return UVSIZE to ensure that this Perl supports 64-bit integers
|
2017-08-25 22:47:47 +02:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------
|
2018-05-22 18:53:08 +02:00
|
|
|
I32
|
|
|
|
libcUvSize()
|
|
|
|
CODE:
|
|
|
|
RETVAL = UVSIZE;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
2017-11-07 05:55:34 +02:00
|
|
|
|
2017-09-17 21:52:19 +02:00
|
|
|
# Exported functions and modules
|
2017-09-30 16:44:03 +02:00
|
|
|
#
|
|
|
|
# These modules should map 1-1 with C modules in src directory.
|
2017-08-25 22:47:47 +02:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------
|
2017-10-18 17:14:26 +02:00
|
|
|
INCLUDE: xs/common/encode.xs
|
2018-04-11 15:36:12 +02:00
|
|
|
INCLUDE: xs/common/lock.xs
|
2017-09-17 21:52:19 +02:00
|
|
|
INCLUDE: xs/config/config.xs
|
2018-02-05 19:32:30 +02:00
|
|
|
INCLUDE: xs/config/configTest.xs
|
2017-11-02 14:14:13 +02:00
|
|
|
INCLUDE: xs/config/define.xs
|
2018-06-11 16:53:16 +02:00
|
|
|
INCLUDE: xs/crypto/cipherBlock.xs
|
2018-06-11 20:52:26 +02:00
|
|
|
INCLUDE: xs/crypto/hash.xs
|
2018-06-11 16:53:16 +02:00
|
|
|
INCLUDE: xs/crypto/random.xs
|
2017-09-17 21:52:19 +02:00
|
|
|
INCLUDE: xs/postgres/pageChecksum.xs
|
2018-04-11 14:21:09 +02:00
|
|
|
INCLUDE: xs/storage/storage.xs
|