summaryrefslogtreecommitdiff
path: root/pp_sys.c
Commit message (Collapse)AuthorAgeFilesLines
* Silence compiler warningJerry D. Hedden2010-07-081-1/+1
| | | | Signed-off-by: David Golden <dagolden@cpan.org>
* avoid multiple FETCH/stringify on filetest opsDavid Mitchell2010-07-031-10/+14
| | | | | some of the filetest operators could call mg_get and/or overload fallback stringify multiple times
* add my_[l]stat_flags(); make my_[l]stat() mathomsDavid Mitchell2010-07-031-4/+4
| | | | | | | my_stat() and my_lstat() call get magic on the stack arg, so create _flags() variants that allow us to control this. (I can't just change the signature or the mg_get() behaviour since my_[l]stat() are listed as being in the public API, even though they're undocumented.)
* Add Perl_croak_no_modify() to implement Perl_croak("%s", PL_no_modify).Nicholas Clark2010-06-271-1/+1
| | | | | This reduces object code size, reducing CPU cache pressure on the non-exception paths.
* Return DIE(...) to *return*ing Perl_die(...).Nicholas Clark2010-06-271-53/+1
| | | | | | | | | Much simplification ensues - witness the diffstat. Changes Perl_die_unwind() to use Perl_croak() rather than DIE(). Reverses an unwise part of bb4c52e023e0fcad. Reverts 9e95c6350a60744d and 805bf316c58ab2d7.
* Note why pp_tie can't use call_method() for a package name.Nicholas Clark2010-06-141-2/+4
| | | | Plus a test that would fail if it did.
* Merge flags and argc parameters to S_tied_handle_method().Nicholas Clark2010-06-131-10/+16
| | | | | | This generates slightly smaller object code overall, which means that the "hot" code (the non-overloaded paths through the ops) will be smaller, and hence more likely to stay in the CPU cache.
* In S_tied_handle_method() default to mortalizing extra arguments.Nicholas Clark2010-06-131-9/+20
| | | | | Convert the gimme argument to a flags argument, and add a flag bit to signal that mortalization is not required. Only "BINMODE" needs this.
* Add a gimme parameter to S_tied_handle_method().Nicholas Clark2010-06-131-16/+13
| | | | This allows "GETC" to use it.
* Change S_tied_handle_method() to varargs to allow extra SV parameters.Nicholas Clark2010-06-131-46/+51
| | | | This enables "BINMODE", "EOF" and "SYSSEEK" to use it.
* Merge simple tied handle method calls into S_tied_handle_method().Nicholas Clark2010-06-131-24/+18
|
* For tied file handle calls, use PUSH* when we know that the stack has space.Nicholas Clark2010-06-131-11/+11
| | | | | Previously the code was using XPUSH* in many cases, often to push back values recently popped off the stack.
* Remove unecessary EXTEND()s from pp_sys.cNicholas Clark2010-06-131-7/+7
| | | | | | | If we've just POP*ed something from the stack, it will already have space. If we conditionally POP* something from the stack, avoid the EXTEND() in that path. Also, use PUSH() rather than XPUSH() where we know that the stack is large enough. Changes to pp_close, pp_binmode, pp_enterwrite, pp_readlink and pp_alarm.
* In pp_eof, ensure stack space for the second argument to the tied EOF method.Nicholas Clark2010-06-131-0/+1
| | | | | Commit 32e653230c7ccc7f added this second argument, but didn't verify that the stack always had sufficient space for it.
* Fix edge case in pp_eof where the stack extent was not checked.Nicholas Clark2010-06-121-4/+8
| | | | | | Analogous to pp_getc and pp_tell in ac3697cd90b00fae, pp_eof has a conditional POP from the stack, but an unconditional PUSH to the stack, but no check that the stack had space for the PUSH. This bug has been present since perl 5.000.
* Fix edge cases in pp_getc and pp_tell where the stack extent was not checked.Nicholas Clark2010-06-121-0/+5
| | | | | | Both conditionally POP a GV from the stack, but always PUSH a return value to it. For the case where they did not POP the GV, they made no check that the stack had space for the PUSH. This bug has been present since perl 5.000.
* make overload respect get magicDavid Mitchell2010-05-211-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In most places, ops checked their args for overload *before* doing mg_get(). This meant that, among other issues, tied vars that returned overloaded objects wouldn't trigger calling the overloaded method. (Actually, for tied and arrays and hashes, it still often would since mg_get gets called beforehand in rvalue context). This patch does the following: Makes sure get magic is called first. Moves most of the overload code formerly included by macros at the start of each pp function into the separate helper functions Perl_try_amagic_bin, Perl_try_amagic_un, S_try_amagic_ftest, with 3 new wrapper macros: tryAMAGICbin_MG, tryAMAGICun_MG, tryAMAGICftest_MG. This made the code 3800 bytes smaller. Makes sure that FETCH is not called multiple times. Much of this bit was helped by some earlier work from Father Chrysostomos. Added new functions and macros sv_inc_nomg(), sv_dec_nomg(), dPOPnv_nomg, dPOPXiirl_ul_nomg, dPOPTOPnnrl_nomg, dPOPTOPiirl_ul_nomg dPOPTOPiirl_nomg, SvIV_please_nomg, SvNV_nomg (again, some of these were based on Father Chrysostomos's work). Fixed the list version of the repeat operator (x): it now only calls overloaded methods for the scalar version: (1,2,$overloaded) x 10 no longer erroneously calls x_method($overloaded,10)) The only thing I haven't checked/fixed yet is overloading the iterator operator, <>.
* use the correct format codes in warnings from gmtime/localtimeTony Cook2010-05-171-5/+5
|
* SV-based interfaces for dieing and warningZefram2010-04-231-62/+53
| | | | | | | | | | | | | | | | | New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act much like their _sv-less counterparts, but take a single SV argument instead of sprintf-like format and args. They will accept RVs, passing them through as such. This means there's no more need to clobber ERRSV in order to throw a structured exception. pp_warn() and pp_die() are rewritten to use the _sv interfaces. This fixes part of [perl #74538]. It also means that a structured warning object will be passed through to $SIG{__WARN__} instead of being stringified, thus bringing warn in line with die with respect to structured exception objects. The new functions and their existing counterparts are all fully documented.
* PL_defoutgv isn't always a GV.David Mitchell2010-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | Nasty code like the following results in PL_defoutgv not pointing to a valid GV: my $x = *STDERR; select($x); $x = 1; This causes all sorts of SEGVs when PL_defoutgv is subsequently accessed, because most code assumes that it has a valid gv_gp pointer. It also turns out that PL_defoutgv is under-tested; for example, temporarily hacking pp_close to make an arg-less close() croak didn't cause any minitest failures. Add a new test file that does some basic testing of a bad PL_defoutgv, and fix all the obvious badness in accessing it. This also fixes #20727, which although ostensibly a tie bug, was due to PL_defoutgv pointing to a tiedelem scalar, and fun like that described above happening.
* Don't try to calculate a time over the conservative failure boundary.Michael G. Schwern2010-02-051-4/+25
| | | | | | | | | | | Otherwise gmtime(2**66) will cause a very, very, very long loop and DOS Perl. Add a test that very, very large times don't send gmtime and localtime into a loop Had to fix some revealed mistakes in op/time.t when warnings were turned on. Fix Time::gmtime and Time::localtime tests to match the new limits of gm/localtime.
* Fix compiler warnings:Jerry D. Hedden2009-11-131-5/+5
| | | | | | | | | | | pp_sys.c: In function `Perl_pp_tie': pp_sys.c:788: warning: 'gv' might be used uninitialized in this function pp_sys.c: In function `Perl_pp_dbmopen': pp_sys.c:936: warning: 'gv' might be used uninitialized in this function pp_sys.c: In function `Perl_pp_enterwrite': pp_sys.c:1274: warning: 'cv' might be used uninitialized in this function pp_sys.c: In function `Perl_pp_ghostent': pp_sys.c:4711: warning: 'hent' might be used uninitialized in this function
* flock() should return EWOULDBLOCK instead of EAGAIN.Jan Dubois2009-11-121-1/+5
| | | | | | | POSIX requires fcntl() to return EAGAIN or EACCES, whereas BSD requires flock() to return EWOULDBLOCK. On most systems EAGAIN and EWOULDBLOCK use the same number, but on some (e.g. Linux on PA-RISC) they do not.
* Add ENTER_with_name and LEAVE_with_name to automaticly check for matching ↵Gerard Goossen2009-11-121-17/+17
| | | | ENTER/LEAVE when debugging is enabled
* SvREFCNT_dec already checks if the SV is non-NULL (continued)Vincent Pit2009-11-081-2/+1
|
* Add a "return NORMAL" to a DIE at the end of a function to prevent compiler ↵Gerard Goossen2009-11-061-0/+51
| | | | warnings (the "return NORMAL"s are never reached).
* move JMPENV_JUMP to die_where and mark it as "noreturn"Gerard Goossen2009-11-061-0/+1
|
* Allow syswrite with offset same as length of string [perl #70095]Gisle Aas2009-10-291-1/+1
| | | | | | You are not really outside of the string then, but the effect will always be a noop since the number of bytes written will be capped to not exceed the length of the string as for other offsets.
* Enable deprecation warnings by default.Nicholas Clark2009-10-161-4/+6
|
* Add Perl_ck_warner(), which combines Perl_ckwarn() and Perl_warner().Nicholas Clark2009-10-121-43/+30
| | | | | | | Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code size (about 0.2%), for 1 more function call if warnings are not enabled. However, if we're now in the L1 or L2 cache when we weren't previously, that's still going to be a speed win.
* Let tell() report warnings on unopened filehandlesRafael Garcia-Suarez2009-10-081-1/+1
| | | | (fixes a bug introduced by previous patch)
* Make tell() fail properly if called without an argument and when no previous ↵Rafael Garcia-Suarez2009-10-081-0/+6
| | | | | | | file was read This makes tell() return -1, and sets errno to EBADF, thus restoring the 5.8.x behaviour
* syswrite prints garbage if called with empty scalar and non-zero offsetchromatic2009-07-271-1/+1
|
* Remove all the 5005threads specific mutex macros, which are now vestigial.Nicholas Clark2009-05-211-2/+0
|
* Remove all #ifdef MACOS_TRADITIONAL code in core and non-dual-life XS code.Nicholas Clark2009-04-271-2/+2
| | | | | | | | (MacOS support was removed from MakeMaker in 6.22, and merged to blead on 15th December 2004 with 5dca256ec738057dc331fb644a93eca44ad5fa14. After this point MacOS wouldn't even have been able to build the perl binary, because it would not have been able to build DynaLoader. If anyone wishes to resurrect MacOS, start by reversing this commit and the relevant part of that commit.)
* Make time64 use NV for time_t, I32 for year, not Quad_t.Craig A. Berry2009-04-251-29/+2
| | | | | | | This means it should run on anything that does not have a 64-bit integer type available but does have a double. Presumably this includes platforms that define PERL_MICRO, so we now use the same extended time implementation for everything that runs Perl.
* GvUNIQUE* have been defined as 0 since 2005/06/30 - high time to remove them.Nicholas Clark2009-04-131-5/+0
|
* Merge commit 'mauzo/over-X' into bleadRafael Garcia-Suarez2009-03-271-2/+52
|\
| * -l was missing an SPAGAIN.Ben Morrow2009-03-251-1/+3
| |
| * Stacked overloaded -X.Ben Morrow2009-03-251-36/+33
| |
| * Finish the rest of the -X ops.Ben Morrow2009-03-251-2/+40
| |
| * Move magic logic into tryAMAGICftest macro.Ben Morrow2009-03-251-11/+1
| |
| * Call -X magic from pp_ftread.Ben Morrow2009-03-251-1/+24
| |
* | Namespace clean-up for time64.Craig A. Berry2009-03-261-2/+2
|/ | | | | | | | | | | | | | | | | | | | All of the time64 functions are only visible within pp_sys.c and are not part of the public API, so make them all static and give them the S_ prefix. A side effect of this is that we now unambiguously use S_localtime64_r and S_gmtime64_r and should no longer collide with system-supplied versions, if any. One possible future direction is that if and when Configure detects any system-supplied *time64_r functions, their prototypes, and their valid time ranges, we could optionally select those instead of the home-grown ones. Another possible future direction is that we could s/S_/Perl_/ and make the *time64_r functions part of the public API in some post-5.10.x release. Currently they are only exposed to the outside world via Perl_pp_gmtime. Also gave some TRACE macros more specific names.
* Ignore the decimal part of any floating point argument passed to localtime ↵Rafael Garcia-Suarez2009-03-131-1/+1
| | | | | | | or gmtime That way the overload warning won't be emitted for non-overflowing floating point values.
* Make overflow warnings in gmtime/localtime only occur when warnings are onRafael Garcia-Suarez2009-03-131-2/+2
|
* Fixing the cast for the result of (getgrent())->gr_gidDavid M. Syzdek2009-03-071-0/+8
| | | | | | | | | | The gr_gid member of struct group is being cast as an int even if system uses an unsigned int. This patch tests for the use of an unsigned int for the gr_gid member and casts the value as appropiate. Created with Arthur Corliss <corliss@corliss@digitalmages.com>. Signed-off-by: David M. Syzdek <david@syzdek.net>
* Skip time64 when there is no 64-bit integer type available.Craig A. Berry2009-02-201-3/+3
| | | | | | | | | | The y2038 code currently requires that a 64-bit integer type be available, so the build falls down hard if we try to use it where there isn't one. A better fix might be to try NV for time_t and a 32-bit integer for year. N.B. We test for the definedness of Quad_t rather than HAS_QUAD since the latter is explicitly undef'd in the case where 64-bit types are available but are not being used for Perl's IV and UV.
* pp_send() doesn't need to allocate 1000 stack slots for syswrite ↵Vincent Pit2009-02-071-3/+2
| | | | $tiedhandle, $buf
* setpgrp() should extend the stack before modifying itNiko Tyni2009-02-041-0/+1
| | | | | As reported by Marcin Owsiany in <http://bugs.debian.org/512796>, invoking setpgrp without any arguments could corrupt the stack.