From 999d65ede909a162fb0accd370ffdf1411e94d5e Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Wed, 26 Dec 2018 12:58:06 +0000 Subject: foo_cloexec() under PERL_GLOBAL_STRUCT_PRIVATE Fix the various Perl_PerlSock_dup2_cloexec() type functions so that t/porting/liberl.a passes under -DPERL_GLOBAL_STRUCT_PRIVATE builds. In these builds it is forbidden to have any static variables, but each of these functions (via convoluted macros) has a static var called 'strategy' which records, for each function, whether a run-time probe has been done to determine the best way of achieving close-exec functionality, and the result. Replace them all with 'global' vars: PL_strategy_dup2 etc. NB these vars aren't thread-safe but it doesn't really matter, as the worst that can happen is for a redundant probe or two to be done before a suitable "don't probe any more" value is written to the var and seen by all the threads. --- perlapi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'perlapi.h') diff --git a/perlapi.h b/perlapi.h index f08bd60a42..6eac8f72c1 100644 --- a/perlapi.h +++ b/perlapi.h @@ -207,6 +207,24 @@ END_EXTERN_C #define PL_sig_trapped (*Perl_Gsig_trapped_ptr(NULL)) #undef PL_sigfpe_saved #define PL_sigfpe_saved (*Perl_Gsigfpe_saved_ptr(NULL)) +#undef PL_strategy_accept +#define PL_strategy_accept (*Perl_Gstrategy_accept_ptr(NULL)) +#undef PL_strategy_dup +#define PL_strategy_dup (*Perl_Gstrategy_dup_ptr(NULL)) +#undef PL_strategy_dup2 +#define PL_strategy_dup2 (*Perl_Gstrategy_dup2_ptr(NULL)) +#undef PL_strategy_mkstemp +#define PL_strategy_mkstemp (*Perl_Gstrategy_mkstemp_ptr(NULL)) +#undef PL_strategy_open +#define PL_strategy_open (*Perl_Gstrategy_open_ptr(NULL)) +#undef PL_strategy_open3 +#define PL_strategy_open3 (*Perl_Gstrategy_open3_ptr(NULL)) +#undef PL_strategy_pipe +#define PL_strategy_pipe (*Perl_Gstrategy_pipe_ptr(NULL)) +#undef PL_strategy_socket +#define PL_strategy_socket (*Perl_Gstrategy_socket_ptr(NULL)) +#undef PL_strategy_socketpair +#define PL_strategy_socketpair (*Perl_Gstrategy_socketpair_ptr(NULL)) #undef PL_sv_placeholder #define PL_sv_placeholder (*Perl_Gsv_placeholder_ptr(NULL)) #undef PL_thr_key -- cgit v1.2.1