In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/8b8c6ab7a0f348f87b1d3cb71ad386b19d348719?hp=df3d7b3a89fec1d036a500ba1f62f1c3d061ed99>
- Log ----------------------------------------------------------------- commit 8b8c6ab7a0f348f87b1d3cb71ad386b19d348719 Author: Andy Dougherty <[email protected]> Date: Tue Dec 29 22:58:51 2015 -0500 Add Configure support for fdclose() for [perl #126847]. This patch also adjusts the generated files suggested by Porting/checkcfgvar.pl. M Configure M Cross/config.sh-arm-linux M NetWare/config.wc M Porting/config.sh M config_h.SH M configure.com M plan9/config_sh.sample M symbian/config.sh M uconfig.h M uconfig.sh M uconfig64.sh M win32/config.ce M win32/config.gc M win32/config.vc commit 36b1c8929241ab83b3003de806e94e66990e4c6d Author: Andy Dougherty <[email protected]> Date: Tue Dec 29 22:47:42 2015 -0500 PATCH: Re: [perl #126847] fdclose(3) patch This patch uses the fdclose() function from FreeBSD if it is available. It is based on the original patch supplied by Mariusz Zaborski <[email protected]> in the RT ticket. The next patch will add Configure support for HAS_FDCLOSE. M perlio.c ----------------------------------------------------------------------- Summary of changes: Configure | 6 ++++++ Cross/config.sh-arm-linux | 1 + NetWare/config.wc | 1 + Porting/config.sh | 1 + config_h.SH | 7 +++++++ configure.com | 1 + perlio.c | 4 +++- plan9/config_sh.sample | 1 + symbian/config.sh | 1 + uconfig.h | 11 +++++++++-- uconfig.sh | 1 + uconfig64.sh | 1 + win32/config.ce | 1 + win32/config.gc | 1 + win32/config.vc | 1 + 15 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Configure b/Configure index cfbdaa1..d5a7de3 100755 --- a/Configure +++ b/Configure @@ -475,6 +475,7 @@ d_fcntl_can_lock='' d_fd_macros='' d_fd_set='' d_fds_bits='' +d_fdclose='' d_fdim='' d_fegetround='' d_fgetpos='' @@ -13991,6 +13992,10 @@ EOM fi $rm_try +: see if fdclose exists +set fdclose d_fdclose +eval $inlibc + : see if fdim exists set fdim d_fdim eval $inlibc @@ -24213,6 +24218,7 @@ d_fcntl='$d_fcntl' d_fcntl_can_lock='$d_fcntl_can_lock' d_fd_macros='$d_fd_macros' d_fd_set='$d_fd_set' +d_fdclose='$d_fdclose' d_fdim='$d_fdim' d_fds_bits='$d_fds_bits' d_fegetround='$d_fegetround' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index 9e3ce16..045ba71 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -199,6 +199,7 @@ d_fcntl='define' d_fcntl_can_lock='define' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='define' diff --git a/NetWare/config.wc b/NetWare/config.wc index e70b4df..d414e98 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -187,6 +187,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='define' d_fegetround='undef' diff --git a/Porting/config.sh b/Porting/config.sh index ec37c3e..dc1d8ea 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -208,6 +208,7 @@ d_fcntl='define' d_fcntl_can_lock='define' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='undef' diff --git a/config_h.SH b/config_h.SH index 01ac23d..e083524 100755 --- a/config_h.SH +++ b/config_h.SH @@ -3561,6 +3561,13 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$d_fcntl_can_lock FCNTL_CAN_LOCK /**/ +/* HAS_FDCLOSE: + * This symbol, if defined, indicates that the fdclose routine is + * available to free a FILE structure without closing the underlying + * file descriptor. This function appeared in FreeBSD 10.2. + */ +#$d_fdclose HAS_FDCLOSE /**/ + /* HAS_FDIM: * This symbol, if defined, indicates that the fdim routine is * available to do the positive difference function. diff --git a/configure.com b/configure.com index 6fdffe0..2d674c5 100644 --- a/configure.com +++ b/configure.com @@ -6003,6 +6003,7 @@ $ WC "d_fcntl='" + d_fcntl + "'" $ WC "d_fcntl_can_lock='" + d_fcntl_can_lock + "'" $ WC "d_fd_set='" + d_fd_set + "'" $ WC "d_fd_macros='define'" +$ WC "d_fdclose='undef'" $ WC "d_fdim='" + d_fdim + "'" $ WC "d_fds_bits='define'" $ WC "d_fegetround='undef'" diff --git a/perlio.c b/perlio.c index 343c62e..69f3755 100644 --- a/perlio.c +++ b/perlio.c @@ -3126,7 +3126,9 @@ PerlIOStdio_invalidate_fileno(pTHX_ FILE *f) /* XXX this could use PerlIO_canset_fileno() and * PerlIO_set_fileno() support from Configure */ -# if defined(__UCLIBC__) +# if defined(HAS_FDCLOSE) + return fdclose(f, NULL) == 0 ? 1 : 0; +# elif defined(__UCLIBC__) /* uClibc must come before glibc because it defines __GLIBC__ as well. */ f->__filedes = -1; return 1; diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample index de1d872..17cefda 100644 --- a/plan9/config_sh.sample +++ b/plan9/config_sh.sample @@ -199,6 +199,7 @@ d_fcntl='define' d_fcntl_can_lock='undef' d_fd_macros='undef' d_fd_set='undef' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='undef' diff --git a/symbian/config.sh b/symbian/config.sh index a5aa477..c6466c9 100644 --- a/symbian/config.sh +++ b/symbian/config.sh @@ -143,6 +143,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='undef' d_fd_set='undef' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='undef' diff --git a/uconfig.h b/uconfig.h index af65ca7..079c73f 100644 --- a/uconfig.h +++ b/uconfig.h @@ -3526,6 +3526,13 @@ */ /*#define FCNTL_CAN_LOCK / **/ +/* HAS_FDCLOSE: + * This symbol, if defined, indicates that the fdclose routine is + * available to free a FILE structure without closing the underlying + * file descriptor. This function appeared in FreeBSD 10.2. + */ +/*#define HAS_FDCLOSE / **/ + /* HAS_FDIM: * This symbol, if defined, indicates that the fdim routine is * available to do the positive difference function. @@ -5175,6 +5182,6 @@ #endif /* Generated from: - * 1fbdd1f584710d990cbc1b624770986e12ad6e3eac21c9f3851e6a0ad5a7fbce config_h.SH - * 0ce9d24f6ed83c533882929bc7c0138fe345656c4b7070aad99bb103dbf3790a uconfig.sh + * 056bddc3ae72075045127f87d3418b2caa44b81bdac54fa0a1a3cf11c8fbdd4a config_h.SH + * a44240b1f83708d59d68e3c6d4d37d0c55ea9a2bab6e0413c17236c9000df18d uconfig.sh * ex: set ro: */ diff --git a/uconfig.sh b/uconfig.sh index bd889e3..c705090 100644 --- a/uconfig.sh +++ b/uconfig.sh @@ -137,6 +137,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='undef' d_fd_set='undef' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='undef' diff --git a/uconfig64.sh b/uconfig64.sh index ec09c1e..8835d61 100644 --- a/uconfig64.sh +++ b/uconfig64.sh @@ -138,6 +138,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='undef' d_fd_set='undef' +d_fdclose='undef' d_fdim='undef' d_fds_bits='undef' d_fegetround='undef' diff --git a/win32/config.ce b/win32/config.ce index 3c10d77..2c978a5 100644 --- a/win32/config.ce +++ b/win32/config.ce @@ -185,6 +185,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='define' d_fegetround='undef' diff --git a/win32/config.gc b/win32/config.gc index e0eb238..7b37e54 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -186,6 +186,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='define' d_fegetround='undef' diff --git a/win32/config.vc b/win32/config.vc index b4efd32..8bf7fba 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -186,6 +186,7 @@ d_fcntl='undef' d_fcntl_can_lock='undef' d_fd_macros='define' d_fd_set='define' +d_fdclose='undef' d_fdim='undef' d_fds_bits='define' d_fegetround='undef' -- Perl5 Master Repository
