summaryrefslogtreecommitdiff
path: root/reentr.h
Commit message (Collapse)AuthorAgeFilesLines
* reentr.[ch]: Add gmtime_r, localtime_rKarl Williamson2020-03-181-6/+41
| | | | | This now replaces occurrences of the non re-entrant versions of these two functions with the reentrant ones.
* reentr.h: Add way to see if reentrant usedKarl Williamson2020-03-181-0/+133
| | | | | | | | | The reentrant mechanism automatically and silently replaces a given function by its reentrant version when warranted. Until now, there was no direct way to test if it actually happens. One could infer it, possibly, but not without the potential for getting it wrong. Now, for function foo, add #ifdef PERL_REENTR_USING_FOO_R
* reentr.h: Add clarifying commentKarl Williamson2020-03-181-2/+4
|
* reentr.[ch]: White-space onlyKarl Williamson2020-03-181-546/+546
| | | | | This is a follow-on to 7c1815b7942f8c7e3651d98060ca7a0760e6483c, that adds some more white space indentation fixes
* reentr.c: Handle getspnam()Karl Williamson2020-03-181-0/+22
| | | | | | | | | | | | | This has never worked to increase the buffer size if necessary. Apparently the default has always been big enough. But this commit fixes it to retry if too small. I don't think there is a way to write tests for this. getspnam is called only as a small part of pp_gpwent, and is not part of the API, and is called only when run as root. I did test it on my box, with gdb, starting with a buffer size of 1, and single stepping and observing that it works as I expected.
* reentr.[ch]: White-space onlyKarl Williamson2020-03-151-591/+649
| | | | | | | | I changed the preprocessor directive indentation to make it easier to grasp the nesting levels, and added blank lines for readability. Some of the changes are for future commits that will remove some nesting.
* Add PERL_REENTRANT for XS modulesKarl Williamson2017-12-131-1/+1
| | | | | | This allows them to get the reentrant versions of libc functions automatically. Previously if they wanted to do this, they had to declare themselves (shudder) as PERL_CORE or PERL_EXT.
* Use new paradigm for hdr file double inclusion guardKarl Williamson2017-06-021-2/+2
| | | | | | | | | | We changed to use symbols not likely to be used by non-Perl code that could conflict, and which have trailing underbars, so they don't look like a regular Perl #define. See https://rt.perl.org/Ticket/Display.html?id=131110 There are many more header files which are not guarded.
* Disable readdir_r and readdir64_r on glibc >= 2.24H.Merijn Brand2017-06-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DESCRIPTION This function is deprecated; use readdir(3) instead. The readdir_r() function was invented as a reentrant version of read- dir(3). It reads the next directory entry from the directory stream dirp, and returns it in the caller-allocated buffer pointed to by entry. For details of the dirent structure, see readdir(3). A pointer to the returned buffer is placed in *result; if the end of the directory stream was encountered, then NULL is instead returned in *result. It is recommended that applications use readdir(3) instead of read- dir_r(). Furthermore, since version 2.24, glibc deprecates read- dir_r(). The reasons are as follows: * On systems where NAME_MAX is undefined, calling readdir_r() may be unsafe because the interface does not allow the caller to specify the length of the buffer used for the returned directory entry. * On some systems, readdir_r() can't read directory entries with very long names. When the glibc implementation encounters such a name, readdir_r() fails with the error ENAMETOOLONG after the final direc- tory entry has been read. On some other systems, readdir_r() may return a success status, but the returned d_name field may not be null terminated or may be truncated. * In the current POSIX.1 specification (POSIX.1-2008), readdir(3) is not required to be thread-safe. However, in modern implementations (including the glibc implementation), concurrent calls to readdir(3) that specify different directory streams are thread-safe. There- fore, the use of readdir_r() is generally unnecessary in multi- threaded programs. In cases where multiple threads must read from the same directory stream, using readdir(3) with external synchro- nization is still preferable to the use of readdir_r(), for the rea- sons given in the points above. * It is expected that a future version of POSIX.1 will make read- dir_r() obsolete, and require that readdir(3) be thread-safe when concurrently employed on different directory streams.
* [perl #115928] we don't use drand48_r or random_r any longerTony Cook2013-09-131-108/+37
| | | | | Removing this should mean that metaconfig will remove the units from the built Configure
* Move all the generated file header printing into read_only_top()Nicholas Clark2011-01-231-2/+3
| | | | | | | | | Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
* reentr.pl -> regen/reentr.plFather Chrysostomos2010-10-131-1/+1
|
* Merge branch 'schwern/y2038' into bleadRafael Garcia-Suarez2009-01-031-37/+6
|\ | | | | | | | | | | | | | | Conflicts: lib/Time/Local.pm lib/Time/Local.t reentr.h
| * Update from y2038Michael G. Schwern2009-01-031-37/+6
| | | | | | | | | | | | Work around a system that doesn't have gm/localtime_r(). This replaces Perl's own gm/localtime() wrapper which couldn't be called outside a PP anyway because it needs my_perl.
* | Lies, damn lies and end-of-block commentsRafael Garcia-Suarez2008-12-251-198/+198
|/ | | | | | | | | | | | | | | | | From: Michael G Schwern <schwern@pobox.com> Date: Fri, 26 Sep 2008 00:06:31 -0400 Message-ID: <48DC5FC7.3000807@pobox.com> I was reading reentr.h and noticed a lot of the endif's for the HAS_XXX_R macros were wrongly indented and their comments had the wrong condition. The attached patch fixes the indentation and removes all but the last comment which is shortest and furthest from its start. No point in an end-of-block comment on a one statement block, just falls out of date and obscures the structure. (plus "make regen")
* Integrate:Jan Dubois2007-02-121-8/+8
| | | | | | | | | | | | | | | | | | | [ 24458] Fix from Steve Peters [ 24464] Subject: RE: 5.8.7-tobe fails to compile on AIX 4.3.3 From: "Jan Dubois" <jand@ActiveState.com> Message-Id: <200505131921.j4DJLgG5007986@smtp3.ActiveState.com> and then regenerate reentr.h, with the , no longer inside REENTR_MEMZERO(). This keeps macros looking like functions. p4raw-link: @24464 on //depot/maint-5.8/perl: 65af2a75d112159ec53912329b2e01abfb9a3fb4 p4raw-link: @24458 on //depot/maint-5.8/perl: ef0ef25c116d419e8978d636281fda0a90743c2a p4raw-id: //depot/perl@30235 p4raw-integrated: from //depot/maint-5.8/perl@24464 'edit in' reentr.pl (@24458..)
* Regenerate all filesRafael Garcia-Suarez2007-01-101-1/+1
| | | p4raw-id: //depot/perl@29747
* RE: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not.Benjamin Holzman2006-11-061-2/+2
| | | | | | From: "Benjamin Holzman" <bholzman@longitude.com> Message-ID: <010801c6ab24$09b9ed30$ce0515ac@office.iseoptions.com> p4raw-id: //depot/perl@29209
* Re: reentr reshuffleJarkko Hietaniemi2006-09-281-198/+198
| | | | | Message-ID: <451BAEE1.1070509@iki.fi> p4raw-id: //depot/perl@28898
* Regen for #28896H.Merijn Brand2006-09-281-151/+263
| | | p4raw-id: //depot/perl@28897
* The previous change causes compile failures with threaded Perls.Steve Peters2006-08-231-5/+0
| | | p4raw-id: //depot/perl@28750
* Part of one of Jarkko's g++ patches that was missed.Steve Peters2006-08-221-0/+5
| | | p4raw-id: //depot/perl@28749
* It's the Barbie bus patchAndy Lester2006-01-101-1/+1
| | | | | Message-ID: <20060110054243.GA26165@petdance.com> p4raw-id: //depot/perl@26764
* a long /etc/groups entry could cause memory exhaustion.Dave Mitchell2005-07-051-61/+61
| | | | | | | Too small a buffer would cause ERANGE and a retry with double the buffer size. later at EOF, the apparent error got 'stuck' as ERANGE rather than ENOENT, so the buffer size doubled recursively p4raw-id: //depot/perl@25084
* Include vim/emacs modelines in generated files to open themRafael Garcia-Suarez2005-05-111-2/+4
| | | | | | in read-only mode. Make vi modelines compatible with non-vim vi versions. p4raw-id: //depot/perl@24445
* Regenerate reentr.[ch]Rafael Garcia-Suarez2005-05-101-7/+18
| | | p4raw-id: //depot/perl@24442
* reentr.h changes so threaded Perl's compile on OpenBSD 3.7Steve Peters2005-05-101-2/+2
| | | | | Message-Id: <20050510021049.GA20147@mccoy.peters.homeunix.org> p4raw-id: //depot/perl@24433
* cast to/from (void *) in the re-entrant code. Now watch the smoke rise.Nicholas Clark2005-04-061-91/+91
| | | p4raw-id: //depot/perl@24176
* Add comment to top of reentr.c and fix typos in other filesDave Mitchell2004-08-011-1/+1
| | | p4raw-id: //depot/perl@23180
* reentr.pl is not defining _srandom_structJan Dubois2003-11-051-0/+3
| | | | | Message-Id: <45igqvsus3hr8bno3si087j5qnrqvn79bf@4ax.com> p4raw-id: //depot/perl@21660
* Re: [PATCH 5.8.1] make reentr.[ch] compatible with 5.8.0 againJan Dubois2003-11-031-94/+94
| | | | | Message-ID: <8dqbqvg16ln2r807l1l2c905lh7hte303v@4ax.com> p4raw-id: //depot/perl@21645
* Detecting errors of reentrant APIs: getgrgid_r and the likeJarkko Hietaniemi2003-04-281-121/+122
| | | | | | | | | | when returning an int can either return the error in the return value or in the errno. We need a new per-interp variable to store the return value instead of clobbering the errno with it. The new variable, PL_reentrant_retint, is only used within the reentrancy framework, and immediately after it's set, so there should not be similar visibility issues as for the errno. Spotted by Edward Moy. p4raw-id: //depot/perl@19357
* Fix up Larry's copyright statements to my best knowledge.Jarkko Hietaniemi2003-04-161-1/+1
| | | | | | | (Lots of Perl 5 source code archaeology was involved.) Larry didn't make strangled noises when I showed him the patch, either :-) p4raw-id: //depot/perl@19242
* Integrate:Jarkko Hietaniemi2003-04-011-2/+2
| | | | | | | | | | [ 19119] Address "5.8.1@19053: crypt_r() takes 128K per thread". p4raw-link: @19119 on //depot/maint-5.8/perl: 5338c2bbd71426ba96ace22615fafeda3d05e36d p4raw-link: @19053 on //depot/maint-5.8/perl: dab75801826d3b09804fff099d3631e91578dcd1 p4raw-id: //depot/perl@19122 p4raw-integrated: from //depot/maint-5.8/perl@19121 'copy in' reentr.c reentr.h reentr.pl (@19106..) 'merge in' pp.c (@19045..)
* Couple more _r possibilities (found in a RH 8.0 box), andJarkko Hietaniemi2003-03-051-36/+62
| | | | | | the random() macros were all wrong. (I don't know why metaconfig did so much reordering of config_h.SH.) p4raw-id: //depot/perl@18831
* Update all copyrights to 2003, from JarkkoHugo van der Sanden2003-03-021-1/+1
| | | p4raw-id: //depot/perl@18801
* Document reentr.pl a bit better. Still ratherJarkko Hietaniemi2002-05-141-1/+1
| | | | | convoluted code, but it ain't broken, so... p4raw-id: //depot/perl@16590
* Avoid potentially empty struct.Jarkko Hietaniemi2002-05-141-0/+1
| | | p4raw-id: //depot/perl@16588
* Remove false dependency between getgrent and setpwentJarkko Hietaniemi2002-04-091-201/+224
| | | | | | having/not having FILE**. Also make the names of the {set,get,end}* interface struct members a bit shorter. p4raw-id: //depot/perl@15831
* The I_CSD, I_S, and V_S had wrong recepting datatype.Jarkko Hietaniemi2002-03-221-37/+37
| | | | | Also, there's no i_stdio. p4raw-id: //depot/perl@15418
* Support crypt_r(const char*,const char*, CRYPTD*).Jarkko Hietaniemi2002-03-191-69/+77
| | | p4raw-id: //depot/perl@15326
* Implement the retry-on-ERANGE for the get*_r().Jarkko Hietaniemi2002-03-171-89/+240
| | | | | The buffer will keep doubling until 64k. p4raw-id: //depot/perl@15272
* HP-UX has also endgrent_r/endpwent_r marked obsolete.Jarkko Hietaniemi2002-03-161-0/+2
| | | p4raw-id: //depot/perl@15253
* Doesn't make sense to test for protos if theJarkko Hietaniemi2002-03-151-27/+27
| | | | | | | functions are not to be used (!= functions exist!) This might be the key (well, a key) to the HP-UX problems. p4raw-id: //depot/perl@15249
* Monster _r patch: try to scan for all known _r variants,Jarkko Hietaniemi2002-03-151-0/+1200
and then use them (under ithreads). May fail in HP-UX, and the op/groups is known to be fickle everywhere. Known to work in Solaris, Linux, Tru64, IRIX, AIX. (Some compiler warnings in AIX since the first arguments of getnetbyaddr and getnetbyadd_r are of different types. Thanks, IBM.) In non-Configure platforms deny the existence of any of the _r thingies. (Also add the recently introduced d_tm_* to places it wasn't already in.) TODO: the suggested glibc buffer growth retry loop in case some entries (at least for: gr*, host*) are big. Forgot win32/config.win64. p4raw-id: //depot/perl@15238