summaryrefslogtreecommitdiff
path: root/pp_sys.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert "Make untie check the FAKE flag on globs""Father Chrysostomos2011-06-111-1/+1
| | | | This reverts commit 84b9ac853508aaff52254b6cf2b95a2a6783ff00.
* Revert "Revert "[perl #77688] tie $scalar can tie a handle""Father Chrysostomos2011-06-111-1/+1
| | | | This reverts commit 7850f4d6b732ab5f426cd3bcd9757c70a46cfda1.
* Revert "Revert "[perl #77496] tied gets scalars and globs confused""Father Chrysostomos2011-06-111-1/+1
| | | | This reverts commit b029825916bf29623e00b45fa4226fab0d52d217.
* Revert ‘Deprecate tie $handle without *’Father Chrysostomos2011-06-111-18/+2
| | | | | This reverts commit 7c7df8124bbdd7a0091f8ed82589548c8182f624, except for the perldiag entry, which we still need for splain’s sake.
* Turn $$ into a magical readonly variable that always fetches getpid() ↵Max Maischein2011-05-221-6/+0
| | | | | | | | | | | instead of caching it The intent is that by not caching $$, we eliminate one opportunity for bugs: If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$ may go out of sync with what getpid() returns. By always fetching the value of $$ via getpid(), this bug opportunity is eliminated. The overhead of always fetching $$ should be small and is likely only used for tempfile creation, which should be dwarfed by file system accesses.
* In pp_warn and pp_die, eliminate pv, which is assigned to but never read.Nicholas Clark2011-05-181-4/+2
|
* [perl #82250] fix tainted (s)print formatDavid Mitchell2011-03-141-2/+0
| | | | | | | | | | | | commit 20ee07fbbcfa6be9f90bb8e5474a4d69d7396617 introduced dieing in (s)printf when the format is tainted; however it only worked when the format is part of an expression (because TAINT_PROPER checks for PL_tainted being set). Fix by doing TAINT_PROPER only after get magic has been done on the format SV (which will set PL_tainted). This is done by moving the checks in pp_sprintf and pp_prtf into do_sprintf() (which is called by the two pp functions).
* [perl #77384] Passing a ref to warn doesn't append file and lineFather Chrysostomos2011-03-051-1/+3
| | | | | This commit makes pp_warn stringify the warning if there is no $SIG{__WARN__} handler. See the RT ticket for the discussion.
* Correct the "unimplemented" message for get{host,net,proto,serv}ent aliases.Nicholas Clark2011-01-101-4/+4
| | | | | | | | | Previously, if all of gethost{byaddr,byname,ent} were unimplemented on a platform, they would all return 'Unsupported socket function "gethostent" called', with the analogous results for getnet{byaddr,byname,ent}, getproto{byname,bynumber,ent} and getserv{byname,byport,ent}. This bug was introduced by change af51a00e97d5c559 - prior to this, all 12 functions would report their own name when unimplemented.
* Merge the implementations of {end,set}{gr,pw}ent with endhostent.Nicholas Clark2011-01-101-44/+28
| | | | | Unlike set{host,net,proto,serv}ent, set{gr,pw}ent don't have stayopen parameter, hence their "signature" is the same as the ent*ent functions.
* Merge the implementations of pp_s{host,net,proto,serv}ent.Nicholas Clark2011-01-101-28/+21
|
* Merge the implementations of pp_e{host,net,proto,serv}ent.Nicholas Clark2011-01-101-32/+21
| | | | | | | PL_op_desc[] rather than PL_op_name(), as the OPs are internally named e*ent, but implement the ent*ent functions, and when unimplemented report themselves using the function name. No need for OP_DESC(), as the switch statement means that we can't encounter OP_CUSTOM.
* Generate "Unsupported socket function" stubs using PL_ppaddr.Nicholas Clark2011-01-091-35/+10
| | | | | | | | | | | | | | | Instead of having each socket op conditionally compile as either the implementation or a DIE() depending on #HAS_SOCKET 1: remove the conditional code from the ops themselves 2: only compile the ops if HAS_SOCKET is defined 3: general conditional code for the intialisation of PL_ppaddr - as appropriate either the ops, or Perl_unimplemented_op 4: Amend Perl_unimplemented_op to generate the appropriate DIE() for socket ops (ie not the "panic"... message) Whilst this complicates the support code in regen/opcode.pl, it's already a net saving of 5 lines in the C code.
* Rename pp_send to pp_syswrite, making send an alias for syswrite.Nicholas Clark2011-01-091-1/+1
| | | | | Previously syswrite was an alias for send. However, syswrite is always available, whereas send is not implemented if HAS_SOCKET is not defined.
* Generate pp_* prototypes in pp_proto.h, and remove pp.symNicholas Clark2011-01-091-2/+2
| | | | | | | | | | | Eliminate the #define pp_foo Perl_pp_foo(pTHX) macros, and update the 13 locations that relied on them. regen/opcode.pl now generates prototypes for the PP functions directly, into pp_proto.h. It no longer writes pp.sym, and regen/embed.pl no longer reads this, removing the only ordering dependency in the regen scripts. opcode.pl is now responsible for prototypes for pp_* functions. (embed.pl remains responsible for ck_* functions, reading from regen/opcodes)
* In pp_send, assign to io earlier, and use op_type instead of PL_op->op_type.Nicholas Clark2011-01-081-5/+3
| | | | | | On this platform, this doesn't change the size of the object code, suggesting that there are all transformations that the optimiser had already spotted. However, the code is now clearer for humans.
* In pp_send, transpose the blocks for OP_SYSWRITE and OP_SENDNicholas Clark2011-01-081-19/+17
|
* Fix typos (spelling errors) in Perl sources.Peter J. Acklam) (via RT2011-01-071-1/+1
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 > Signed-off-by: Abigail <abigail@abigail.be>
* Convert tied PRINT to using Perl_tied_method()Nicholas Clark2011-01-051-0/+6
| | | | | Add a flag TIED_METHOD_SAY to Perl_tied_method(), to allow tied PRINT to effect C<local $\ = "\n";> within the ENTER/LEAVE pair of Perl_tied_method().
* Rename tied_handle_method() to tied_method(), and make it non-static.Nicholas Clark2011-01-051-46/+41
| | | | It can be used for (at least) the call to "SPLICE" from pp_splice.
* In pp_sys.c, rename the macro tied_handle_method() to tied_handle_method0()Nicholas Clark2011-01-051-4/+4
| | | | | This makes it clear that it's not a direct aTHX_ wrapper for S_tied_handle_method().
* The mg parameter to S_tied_handle_method() can be const MG *Nicholas Clark2011-01-051-13/+13
|
* Split the flags and argc parameters to S_tied_handle_method().Nicholas Clark2011-01-051-22/+18
| | | | | Previously they were combined into one numeric value, using a bitshift. This was a false economy.
* Convert tied WRITE to using S_tied_handle_method()Nicholas Clark2011-01-041-6/+3
|
* Convert tied READ to using S_tied_handle_method()Nicholas Clark2011-01-041-7/+4
|
* Convert tied PRINTF to using S_tied_handle_method()Nicholas Clark2011-01-041-7/+3
|
* Convert tied OPEN to using S_tied_handle_method()Nicholas Clark2011-01-041-8/+8
| | | | | Add a new flag ARGUMENTS_ON_STACK to S_tied_handle_method(), which methods which take a list (OPEN, PRINTF, READ and WRITE) will need.
* In pp_sys.c, move S_tied_handle_method() before pp_open.Nicholas Clark2011-01-041-48/+48
|
* Remove a long-vestigial PUTBACK from the tied OPEN code in pp_send.Nicholas Clark2011-01-041-1/+0
| | | | | | | | | | | | | | Commit 4592e6caefc41a75, from 1999, added the PUTBACK as part of the initial implementation of tied OPEN. At this time, pp_open (as then was) popped the arguments off the stack (to local variables), so the new tie code pushed them back onto the stack, before calling the method. The stack position was manipulated, hence the local variable sp had potentially diverged from the global PL_stack_sp, hence the latter needed updating. Commit a567e93b903bc984, from 2001, which added support for open $fh, '|-', @array; refactored pp_open to avoid all stack manipulation. Hence sp (the local variable) never changes along this code path, hence it never needs to be written back to PL_stack_sp.
* Converge the implementation of tied OPEN with PRINTF, READ and WRITE.Nicholas Clark2011-01-041-2/+2
| | | | Consistency will make it easier to refactor.
* GvIO(gv) returns NULL for a NULL gv, so refactor to take advantage of this.Nicholas Clark2011-01-021-30/+25
| | | | | | Simplify tests of !gv || !io to just !io, avoid calling GvIO(gv) more than once, and where possible initialise io at declaration time, to allow it to be const.
* make <expr> always overload if expr is overloadedDavid Mitchell2011-01-021-1/+6
| | | | | | | | Due to the way that '<> as glob' was parsed differently from '<> as filehandle' from 5.6 onwards, something like <$foo[0]> didn't handle overloading, even where $foo[0] was an overloaded object. This was contrary to the docs for overload, and meant that <> couldn't be used as a general overloaded iterator operator.
* call pp_glob() even when its being skippedDavid Mitchell2011-01-021-0/+10
| | | | | | | | | | | | | | Currently when an external Perl glob function is used (which is most of the time), the OP_GLOB op is removed and replaced with the pair: GV("CORE::GLOBAL::glob"), ENTERSUB. This commit re-adds the OP_GLOB to the op tree, but with OPf_SPECIAL set; and pp_glob() is updated to just return if OPf_SPECIAL is set. Thus there's no change in outward functionality with this commit. However, by always calling pp_glob(), it will allow us (in the next commit) to handle iterator overloading consistently, regardless of whether the internal globbing function is used or not.
* standardise amagic method namingDavid Mitchell2010-12-311-1/+1
| | | | | | | | | | | | | | Some amagic-related macros take the full method enumeration name, (e.g. "add_amg"); while others "helpfully" allow you to pass a shortened version, ("add"), and do a CAT2(meth,_amg) behind the scenes. Standardise on passing the full name; this makes it less confusing and allows you to grep for the enumeration name in the source. It updates two macros to accept full enumeration names: tryAMAGICunTARGET (which isn't used outside the core apparently), and AMG_CALLun, which is replaced by a new AMG_CALLunary (since AMG_CALLun is used outside the core).
* Merge the opcode bodies for pp_bind and pp_connect.Nicholas Clark2010-12-301-32/+7
|
* Most socket ops weren't warning for unopened handles unless 'closed' was enabledNicholas Clark2010-12-301-14/+7
| | | | | | They were checking that category 'closed' was enabled for warnings before calling report_evil_fh(), which in turn was (correctly) checking category 'unopened'.
* pp_leavewrite wasn't warning for unopened handles unless 'closed' was enabled.Nicholas Clark2010-12-301-1/+1
| | | | | It was checking that category 'closed' was enabled for warnings before calling report_evil_fh(), which in turn was (correctly) checking category 'unopened'.
* As report_evil_fh() checks WARN_{CLOSED,UNOPENED}, don't duplicate this.Nicholas Clark2010-12-281-38/+21
| | | | | | | | | | This trades reduced code size for an extra function call in the error path with warnings disabled. (And removes a duplicated check for the case of taking the error path *with* warnings enabled.) Removing the check from Perl_do_close() does not change behaviour, as io is NULL there, hence Perl_report_evil_fh() will always be checking WARN_UNOPENED and setting vile to "unopened".
* As report_wrongway_fh() checks ckWARN(WARN_IO) internally, don't duplicate this.Nicholas Clark2010-12-281-13/+9
| | | | | | This trades reduced code size for an extra function call in the error path with warnings disabled. (And removes a duplicated check for the case of taking the error path *with* warnings enabled.)
* Argument op to report_evil_fh() is always PL_op->op_type, so need not be passedNicholas Clark2010-12-281-24/+24
|
* The io argument to report_evil_fh() is always GvIO(gv), so need not be passed.Nicholas Clark2010-12-281-24/+24
|
* Extract the OP_phoney_* code from report_evil_fh() into report_wrongway_fh()Nicholas Clark2010-12-281-4/+4
| | | | | Previously Perl_report_evil_fh()'s body was just an if/else at the top level - a good sign that it is actually implementing two disjoint functions.
* In pp_sockpair, remove duplication of code to close the supplied file handles.Nicholas Clark2010-12-281-7/+5
| | | | | | It's not necessary to (also) test gv1 and gv2 before returning undef as an error, because io1 will automatically be NULL if gv1 is NULL, and similarly io2 if gv2 is.
* Fix typo in warning code added to pp_sockpair in c289d2f7288798f8.Nicholas Clark2010-12-281-1/+1
| | | | | | | That should be gv2, not gv1. However, I believe that it's impossible to reach the warning code, given the structure of the optree that the perl 5 implementation produces, as gv1 and gv2 will never be NULL, and GvIOn() will always return non-NULL. (Or croak, but that won't return).
* avoid undefined behaviour in fetch and modify of SP from 0a0e3cc51eTony Cook2010-12-281-1/+2
| | | | | pp_sys.c: In function ‘Perl_pp_send’: pp_sys.c:1845: warning: operation on ‘sp’ may be undefined
* Simplify return handling for tied handle OPEN/PRINTF/READ/WRITE.Nicholas Clark2010-12-271-22/+5
| | | | | | | | Their code used to explicitly move the return value from its current position on the stack, to the position that was top of top of the stack just before the call was made. However, the POPBLOCK() in pp_leavesub will restore the stack pointer, and passing G_SCALAR to call_method() will force exactly one return value, so all of this is needless defensiveness.
* [perl #80674] Fix compilation with very old versions of glibcDavid Leadbeater2010-12-161-1/+1
| | | | | | | | | | | __priority_which_t does not exist on glibc 2.1. sin6_scope is not present in the set of kernel headers my copy of glibc 2.1 is using. (The presence of sin6_scope in sockaddr_in6 should maybe be a Configure test.) blead now compiles on a positively ancient box -- although the Socket tests fail.
* Silence some data truncation compiler warningsJan Dubois2010-12-161-1/+1
|
* Deprecate tie $handle without *Father Chrysostomos2010-12-021-2/+18
|
* Revert "[perl #77496] tied gets scalars and globs confused"Father Chrysostomos2010-12-021-1/+1
| | | | This reverts commit 8752206e276cffe588c0932b5a9f2331640e8447.