1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Opcode - perldoc.perl.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-gb">
<link href="static/css-20090810.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
</head>
<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
<div id="page">
<div id="header">
<div id="homepage_link">
<a href="index.html"></a>
</div>
<div id="search_form">
<form action="search.html" method="GET" id="search">
<input type="text" name="q" id="search_box" alt="Search">
</form>
</div>
</div>
<div id="body">
<div id="left_column">
<div class="side_group">
<div class="side_panel doc_panel">
<p>Manual</p>
<ul>
<li><a href="index-overview.html">Overview</a>
<li><a href="index-tutorials.html">Tutorials</a>
<li><a href="index-faq.html">FAQs</a>
<li><a href="index-history.html">History / Changes</a>
<li><a href="index-licence.html">License</a>
</ul>
</div>
<div class="side_panel doc_panel">
<p>Reference</p>
<ul>
<li><a href="index-language.html">Language</a>
<li><a href="index-functions.html">Functions</a>
<li><a href="perlop.html">Operators</a>
<li><a href="perlvar.html">Special Variables</a>
<li><a href="index-pragmas.html">Pragmas</a>
<li><a href="index-utilities.html">Utilities</a>
<li><a href="index-internals.html">Internals</a></li>
<li><a href="index-platforms.html">Platform Specific</a>
</ul>
</div>
<div class="side_panel doc_panel">
<p>Modules</p>
<ul>
<li>
<a href="index-modules-A.html">A</a>
•
<a href="index-modules-B.html">B</a>
•
<a href="index-modules-C.html">C</a>
•
<a href="index-modules-D.html">D</a>
•
<a href="index-modules-E.html">E</a>
<li>
<a href="index-modules-F.html">F</a>
•
<a href="index-modules-G.html">G</a>
•
<a href="index-modules-H.html">H</a>
•
<a href="index-modules-I.html">I</a>
•
<a href="index-modules-L.html">L</a>
<li>
<a href="index-modules-M.html">M</a>
•
<a href="index-modules-N.html">N</a>
•
<a href="index-modules-O.html">O</a>
•
<a href="index-modules-P.html">P</a>
•
<a href="index-modules-S.html">S</a>
<li>
<a href="index-modules-T.html">T</a>
•
<a href="index-modules-U.html">U</a>
•
<a href="index-modules-X.html">X</a>
</ul>
</div>
</div>
<div class="side_group">
<div class="side_panel links_panel">
<p>News / Blogs</p>
<ul>
<li><a href="http://perlbuzz.com">Perl Buzz</a></li>
<li><a href="http://ironman.enlightenedperl.org">Perl Iron Man</a></li>
<li><a href="http://perlsphere.net">Perlsphere</a></li>
<li><a href="http://planet.perl.org">Planet Perl</a></li>
<li><a href="http://news.perlfoundation.org/">TPF news</a></li>
<li><a href="http://use.perl.org">Use Perl</a></li>
</ul>
</div>
<div class="side_panel links_panel">
<p>See also</p>
<ul>
<li><a href="http://search.cpan.org">CPAN</a></li>
<li><a href="http://www.perl.org">Perl.org</a></li>
<li><a href="http://www.perl.com">Perl.com</a></li>
<li><a href="http://www.perlfoundation.org/perl5/index.cgi">Perl 5 Wiki</a></li>
<li><a href="http://jobs.perl.org">Perl Jobs</a></li>
<li><a href="http://www.pm.org">Perl Mongers</a></li>
<li><a href="http://www.perlmonks.org">Perl Monks</a></li>
</ul>
</div>
<div class="side_panel links_panel">
<p>Contact</p>
<ul>
<li><a href="http://perl.jonallen.info">Site designed and maintained by Jon Allen (JJ)</a>
<li><a href="http://perl.jonallen.info">http://perl.jonallen.info</a>
</ul>
<ul>
<li><a href="http://perl.jonallen.info/projects/perldoc">View the project page and FAQs</a>
</ul>
</div>
</div>
</div>
<div id="centre_column">
<div id="content_header">
<div id="title_bar">
<div id="page_name">
<h1>Opcode</h1>
</div>
<div id="perl_version">
Perl 5 version 10.1 documentation
</div>
<div id="page_links">
<a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
• <a href="#" id="page_index_toggle">Show page index</a>
</div>
</div>
<div id="breadcrumbs">
<a href="index.html">Home</a> >
<a href="index-modules-O.html">Core modules (O)</a> >
Opcode
</div>
</div>
<div id="content_body">
<!--[if lt IE 7]>
<div class="noscript">
<p>
<strong>It looks like you're using Internet Explorer 6. This is a very old
browser which does not offer full support for modern websites.</strong>
</p>
<p>
Unfortunately this means that this website will not work on
your computer.
</p>
<p>
Don't miss out though! To view the site (and get a better experience from
many other websites), simply upgrade to
<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
or download an alternative browser such as
<a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
<a href="http://www.apple.com/safari/download/">Safari</a>, or
<a href="http://www.google.co.uk/chrome">Google Chrome</a>.
</p>
<p>
All of these browsers are free. If you're using a PC at work, you may
need to contact your IT administrator.
</p>
</div>
<![endif]-->
<noscript>
<div class="noscript">
<p>
<strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
or are running a non-JavaScript capable web browser.</strong>
</p>
<p>
To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
</p>
</div>
</noscript>
<div id="from_search"></div>
<h1>Opcode</h1>
<!-- -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#NOTE">NOTE</a><li><a href="#WARNING">WARNING</a><li><a href="#Operator-Names-and-Operator-Lists">Operator Names and Operator Lists</a><li><a href="#Opcode-Functions">Opcode Functions</a><li><a href="#Manipulating-Opsets">Manipulating Opsets</a><li><a href="#TO-DO-(maybe)">TO DO (maybe)</a><li><a href="#Predefined-Opcode-Tags">Predefined Opcode Tags</a><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#AUTHORS">AUTHORS</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>Opcode - Disable named opcodes when compiling perl code</p>
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/use.html">use</a> <span class="w">Opcode</span><span class="sc">;</span></li></ol></pre><a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>Perl code is always compiled into an internal format before execution.</p>
<p>Evaluating perl code (e.g. via "eval" or "do 'file'") causes
the code to be compiled into an internal format and then,
provided there was no error in the compilation, executed.
The internal format is based on many distinct <i>opcodes</i>.</p>
<p>By default no opmask is in effect and any code can be compiled.</p>
<p>The Opcode module allow you to define an <i>operator mask</i> to be in
effect when perl <i>next</i> compiles any code. Attempting to compile code
which contains a masked opcode will cause the compilation to fail
with an error. The code will not be executed.</p>
<a name="NOTE"></a><h1>NOTE</h1>
<p>The Opcode module is not usually used directly. See the ops pragma and
Safe modules for more typical uses.</p>
<a name="WARNING"></a><h1>WARNING</h1>
<p>The authors make <b>no warranty</b>, implied or otherwise, about the
suitability of this software for safety or security purposes.</p>
<p>The authors shall not in any case be liable for special, incidental,
consequential, indirect or other similar damages arising from the use
of this software.</p>
<p>Your mileage will vary. If in any doubt <b>do not use it</b>.</p>
<a name="Operator-Names-and-Operator-Lists"></a><h1>Operator Names and Operator Lists</h1>
<p>The canonical list of operator names is the contents of the array
PL_op_name defined and initialised in file <i>opcode.h</i> of the Perl
source distribution (and installed into the perl library).</p>
<p>Each operator has both a terse name (its opname) and a more verbose or
recognisable descriptive name. The opdesc function can be used to
return a list of descriptions for a list of operators.</p>
<p>Many of the functions and methods listed below take a list of
operators as parameters. Most operator lists can be made up of several
types of element. Each element can be one of</p>
<ul>
<li><a name="an-operator-name-(opname)"></a><b>an operator name (opname)</b>
<p>Operator names are typically small lowercase words like enterloop,
leaveloop, last, next, redo etc. Sometimes they are rather cryptic
like gv2cv, i_ncmp and ftsvtx.</p>
</li>
<li><a name="an-operator-tag-name-(optag)"></a><b>an operator tag name (optag)</b>
<p>Operator tags can be used to refer to groups (or sets) of operators.
Tag names always begin with a colon. The Opcode module defines several
optags and the user can define others using the define_optag function.</p>
</li>
<li><a name="a-negated-opname-or-optag"></a><b>a negated opname or optag</b>
<p>An opname or optag can be prefixed with an exclamation mark, e.g., !mkdir.
Negating an opname or optag means remove the corresponding ops from the
accumulated set of ops at that point.</p>
</li>
<li><a name="an-operator-set-(opset)"></a><b>an operator set (opset)</b>
<p>An <i>opset</i> as a binary string of approximately 44 bytes which holds a
set or zero or more operators.</p>
<p>The opset and opset_to_ops functions can be used to convert from
a list of operators to an opset and <i>vice versa</i>.</p>
<p>Wherever a list of operators can be given you can use one or more opsets.
See also Manipulating Opsets below.</p>
</li>
</ul>
<a name="Opcode-Functions"></a><h1>Opcode Functions</h1>
<p>The Opcode package contains functions for manipulating operator names
tags and sets. All are available for export by the package.</p>
<ul>
<li><a name="opcodes"></a><b>opcodes</b>
<p>In a scalar context opcodes returns the number of opcodes in this
version of perl (around 350 for perl-5.7.0).</p>
<p>In a list context it returns a list of all the operator names.
(Not yet implemented, use @names = opset_to_ops(full_opset).)</p>
</li>
<li><a name="opset-(OP%2c-...)"></a><b>opset (OP, ...)</b>
<p>Returns an opset containing the listed operators.</p>
</li>
<li><a name="opset_to_ops-(OPSET)"></a><b>opset_to_ops (OPSET)</b>
<p>Returns a list of operator names corresponding to those operators in
the set.</p>
</li>
<li><a name="opset_to_hex-(OPSET)"></a><b>opset_to_hex (OPSET)</b>
<p>Returns a string representation of an opset. Can be handy for debugging.</p>
</li>
<li><a name="full_opset"></a><b>full_opset</b>
<p>Returns an opset which includes all operators.</p>
</li>
<li><a name="empty_opset"></a><b>empty_opset</b>
<p>Returns an opset which contains no operators.</p>
</li>
<li><a name="invert_opset-(OPSET)"></a><b>invert_opset (OPSET)</b>
<p>Returns an opset which is the inverse set of the one supplied.</p>
</li>
<li><a name="verify_opset-(OPSET%2c-...)"></a><b>verify_opset (OPSET, ...)</b>
<p>Returns true if the supplied opset looks like a valid opset (is the
right length etc) otherwise it returns false. If an optional second
parameter is true then verify_opset will croak on an invalid opset
instead of returning false.</p>
<p>Most of the other Opcode functions call verify_opset automatically
and will croak if given an invalid opset.</p>
</li>
<li><a name="define_optag-(OPTAG%2c-OPSET)"></a><b>define_optag (OPTAG, OPSET)</b>
<p>Define OPTAG as a symbolic name for OPSET. Optag names always start
with a colon <code class="inline"><span class="j">:</span></code>
.</p>
<p>The optag name used must not be defined already (define_optag will
croak if it is already defined). Optag names are global to the perl
process and optag definitions cannot be altered or deleted once
defined.</p>
<p>It is strongly recommended that applications using Opcode should use a
leading capital letter on their tag names since lowercase names are
reserved for use by the Opcode module. If using Opcode within a module
you should prefix your tags names with the name of your module to
ensure uniqueness and thus avoid clashes with other modules.</p>
</li>
<li><a name="opmask_add-(OPSET)"></a><b>opmask_add (OPSET)</b>
<p>Adds the supplied opset to the current opmask. Note that there is
currently <i>no</i> mechanism for unmasking ops once they have been masked.
This is intentional.</p>
</li>
<li><a name="opmask"></a><b>opmask</b>
<p>Returns an opset corresponding to the current opmask.</p>
</li>
<li><a name="opdesc-(OP%2c-...)"></a><b>opdesc (OP, ...)</b>
<p>This takes a list of operator names and returns the corresponding list
of operator descriptions.</p>
</li>
<li><a name="opdump-(PAT)"></a><b>opdump (PAT)</b>
<p>Dumps to STDOUT a two column list of op names and op descriptions.
If an optional pattern is given then only lines which match the
(case insensitive) pattern will be output.</p>
<p>It's designed to be used as a handy command line utility:</p>
<pre class="verbatim"><ol><li> <span class="w">perl</span> -<span class="w">MOpcode</span>=<span class="w">opdump</span> -e <span class="w">opdump</span></li><li> <span class="w">perl</span> -<span class="w">MOpcode</span>=<span class="w">opdump</span> -e <span class="q">'opdump Eval'</span></li></ol></pre></li>
</ul>
<a name="Manipulating-Opsets"></a><h1>Manipulating Opsets</h1>
<p>Opsets may be manipulated using the perl bit vector operators & (and), | (or),
^ (xor) and ~ (negate/invert).</p>
<p>However you should never rely on the numerical position of any opcode
within the opset. In other words both sides of a bit vector operator
should be opsets returned from Opcode functions.</p>
<p>Also, since the number of opcodes in your current version of perl might
not be an exact multiple of eight, there may be unused bits in the last
byte of an upset. This should not cause any problems (Opcode functions
ignore those extra bits) but it does mean that using the ~ operator
will typically not produce the same 'physical' opset 'string' as the
invert_opset function.</p>
<a name="TO-DO-(maybe)"></a><h1>TO DO (maybe)</h1>
<pre class="verbatim"><ol><li> $bool = opset_eq($opset1, $opset2) true if opsets are logically eqiv</li><li></li><li> $yes = opset_can($opset, @ops) true if $opset has all @ops set</li><li></li><li> @diff = opset_diff($opset1, $opset2) => ('foo', '!bar', ...)</li></ol></pre><a name="Predefined-Opcode-Tags"></a><h1>Predefined Opcode Tags</h1>
<ul>
<li><a name="%3abase_core"></a><b>:base_core</b>
<pre class="verbatim"><ol><li> null stub scalar pushmark wantarray const defined undef</li><li></li><li> rv2sv sassign</li><li></li><li> rv2av aassign aelem aelemfast aslice av2arylen</li><li></li><li> rv2hv helem hslice each values keys exists delete</li><li></li><li> preinc i_preinc predec i_predec postinc i_postinc postdec i_postdec</li><li> int hex oct abs pow multiply i_multiply divide i_divide</li><li> modulo i_modulo add i_add subtract i_subtract</li><li></li><li> left_shift right_shift bit_and bit_xor bit_or negate i_negate</li><li> not complement</li><li></li><li> lt i_lt gt i_gt le i_le ge i_ge eq i_eq ne i_ne ncmp i_ncmp</li><li> slt sgt sle sge seq sne scmp</li><li></li><li> substr vec stringify study pos length index rindex ord chr</li><li></li><li> ucfirst lcfirst uc lc quotemeta trans chop schop chomp schomp</li><li></li><li> match split qr</li><li></li><li> list lslice splice push pop shift unshift reverse</li><li></li><li> cond_expr flip flop andassign orassign dorassign and or dor xor</li><li></li><li> warn die lineseq nextstate scope enter leave setstate</li><li></li><li> rv2cv anoncode prototype</li><li></li><li> entersub leavesub leavesublv return method method_named -- XXX loops via recursion?</li><li></li><li> leaveeval -- needed for Safe to operate, is safe without entereval</li></ol></pre></li>
<li><a name="%3abase_mem"></a><b>:base_mem</b>
<p>These memory related ops are not included in :base_core because they
can easily be used to implement a resource attack (e.g., consume all
available memory).</p>
<pre class="verbatim"><ol><li> <span class="w">concat</span> <span class="w">repeat</span> <a class="l_k" href="functions/join.html">join</a> <span class="w">range</span></li><li></li><li> <span class="w">anonlist</span> <span class="w">anonhash</span></li></ol></pre><p>Note that despite the existence of this optag a memory resource attack
may still be possible using only :base_core ops.</p>
<p>Disabling these ops is a <i>very</i> heavy handed way to attempt to prevent
a memory resource attack. It's probable that a specific memory limit
mechanism will be added to perl in the near future.</p>
</li>
<li><a name="%3abase_loop"></a><b>:base_loop</b>
<p>These loop ops are not included in :base_core because they can easily be
used to implement a resource attack (e.g., consume all available CPU time).</p>
<pre class="verbatim"><ol><li> <span class="w">grepstart</span> <span class="w">grepwhile</span></li><li> <span class="w">mapstart</span> <span class="w">mapwhile</span></li><li> <span class="w">enteriter</span> <span class="w">iter</span></li><li> <span class="w">enterloop</span> <span class="w">leaveloop</span> <span class="w">unstack</span></li><li> <a class="l_k" href="functions/last.html">last</a> <a class="l_k" href="functions/next.html">next</a> <a class="l_k" href="functions/redo.html">redo</a></li><li> <a class="l_k" href="functions/goto.html">goto</a></li></ol></pre></li>
<li><a name="%3abase_io"></a><b>:base_io</b>
<p>These ops enable <i>filehandle</i> (rather than filename) based input and
output. These are safe on the assumption that only pre-existing
filehandles are available for use. Usually, to create new filehandles
other ops such as open would need to be enabled, if you don't take into
account the magical open of ARGV.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/readline.html">readline</a> <span class="w">rcatline</span> <a class="l_k" href="functions/getc.html">getc</a> <a class="l_k" href="functions/read.html">read</a></li><li></li><li> <a class="l_k" href="functions/formline.html">formline</a> <span class="w">enterwrite</span> <span class="w">leavewrite</span></li><li></li><li> <a class="l_k" href="functions/print.html">print</a> <a class="l_k" href="functions/say.html">say</a> <a class="l_k" href="functions/sysread.html">sysread</a> <a class="l_k" href="functions/syswrite.html">syswrite</a> <a class="l_k" href="functions/send.html">send</a> <a class="l_k" href="functions/recv.html">recv</a></li><li></li><li> <a class="l_k" href="functions/eof.html">eof</a> <a class="l_k" href="functions/tell.html">tell</a> <a class="l_k" href="functions/seek.html">seek</a> <a class="l_k" href="functions/sysseek.html">sysseek</a></li><li></li><li> <a class="l_k" href="functions/readdir.html">readdir</a> <a class="l_k" href="functions/telldir.html">telldir</a> <a class="l_k" href="functions/seekdir.html">seekdir</a> <a class="l_k" href="functions/rewinddir.html">rewinddir</a></li></ol></pre></li>
<li><a name="%3abase_orig"></a><b>:base_orig</b>
<p>These are a hotchpotch of opcodes still waiting to be considered</p>
<pre class="verbatim"><ol><li> gvsv gv gelem</li><li></li><li> padsv padav padhv padany</li><li></li><li> once</li><li></li><li> rv2gv refgen srefgen ref</li><li></li><li> bless -- could be used to change ownership of objects (reblessing)</li><li></li><li> pushre regcmaybe regcreset regcomp subst substcont</li><li></li><li> sprintf prtf -- can core dump</li><li></li><li> crypt</li><li></li><li> tie untie</li><li></li><li> dbmopen dbmclose</li><li> sselect select</li><li> pipe_op sockpair</li><li></li><li> getppid getpgrp setpgrp getpriority setpriority localtime gmtime</li><li></li><li> entertry leavetry -- can be used to 'hide' fatal errors</li><li></li><li> entergiven leavegiven</li><li> enterwhen leavewhen</li><li> break continue</li><li> smartmatch</li><li></li><li> custom -- where should this go</li></ol></pre></li>
<li><a name="%3abase_math"></a><b>:base_math</b>
<p>These ops are not included in :base_core because of the risk of them being
used to generate floating point exceptions (which would have to be caught
using a $SIG{FPE} handler).</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/atan2.html">atan2</a> <a class="l_k" href="functions/sin.html">sin</a> <a class="l_k" href="functions/cos.html">cos</a> <a class="l_k" href="functions/exp.html">exp</a> <a class="l_k" href="functions/log.html">log</a> <a class="l_k" href="functions/sqrt.html">sqrt</a></li></ol></pre><p>These ops are not included in :base_core because they have an effect
beyond the scope of the compartment.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/rand.html">rand</a> <a class="l_k" href="functions/srand.html">srand</a></li></ol></pre></li>
<li><a name="%3abase_thread"></a><b>:base_thread</b>
<p>These ops are related to multi-threading.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/lock.html">lock</a></li></ol></pre></li>
<li><a name="%3adefault"></a><b>:default</b>
<p>A handy tag name for a <i>reasonable</i> default set of ops. (The current ops
allowed are unstable while development continues. It will change.)</p>
<pre class="verbatim"><ol><li> :base_core :base_mem :base_loop :base_orig :base_thread</li></ol></pre><p>This list used to contain :base_io prior to Opcode 1.07.</p>
<p>If safety matters to you (and why else would you be using the Opcode module?)
then you should not rely on the definition of this, or indeed any other, optag!</p>
</li>
<li><a name="%3afilesys_read"></a><b>:filesys_read</b>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/stat.html">stat</a> <a class="l_k" href="functions/lstat.html">lstat</a> <a class="l_k" href="functions/readlink.html">readlink</a></li><li></li><li> <span class="w">ftatime</span> <span class="w">ftblk</span> <span class="w">ftchr</span> <span class="w">ftctime</span> <span class="w">ftdir</span> <span class="w">fteexec</span> <span class="w">fteowned</span> <span class="w">fteread</span></li><li> <span class="w">ftewrite</span> <span class="w">ftfile</span> <span class="w">ftis</span> <span class="w">ftlink</span> <span class="w">ftmtime</span> <span class="w">ftpipe</span> <span class="w">ftrexec</span> <span class="w">ftrowned</span></li><li> <span class="w">ftrread</span> <span class="w">ftsgid</span> <span class="w">ftsize</span> <span class="w">ftsock</span> <span class="w">ftsuid</span> <span class="w">fttty</span> <span class="w">ftzero</span> <span class="w">ftrwrite</span> <span class="w">ftsvtx</span></li><li></li><li> <span class="w">fttext</span> <span class="w">ftbinary</span></li><li></li><li> <a class="l_k" href="functions/fileno.html">fileno</a></li></ol></pre></li>
<li><a name="%3asys_db"></a><b>:sys_db</b>
<pre class="verbatim"><ol><li> ghbyname ghbyaddr ghostent shostent ehostent -- hosts</li><li> gnbyname gnbyaddr gnetent snetent enetent -- networks</li><li> gpbyname gpbynumber gprotoent sprotoent eprotoent -- protocols</li><li> gsbyname gsbyport gservent sservent eservent -- services</li><li></li><li> gpwnam gpwuid gpwent spwent epwent getlogin -- users</li><li> ggrnam ggrgid ggrent sgrent egrent -- groups</li></ol></pre></li>
<li><a name="%3abrowse"></a><b>:browse</b>
<p>A handy tag name for a <i>reasonable</i> default set of ops beyond the
:default optag. Like :default (and indeed all the other optags) its
current definition is unstable while development continues. It will change.</p>
<p>The :browse tag represents the next step beyond :default. It it a
superset of the :default ops and adds :filesys_read the :sys_db.
The intent being that scripts can access more (possibly sensitive)
information about your system but not be able to change it.</p>
<pre class="verbatim"><ol><li> :default :filesys_read :sys_db</li></ol></pre></li>
<li><a name="%3afilesys_open"></a><b>:filesys_open</b>
<pre class="verbatim"><ol><li> sysopen open close</li><li> umask binmode</li><li></li><li> open_dir closedir -- other dir ops are in :base_io</li></ol></pre></li>
<li><a name="%3afilesys_write"></a><b>:filesys_write</b>
<pre class="verbatim"><ol><li> link unlink rename symlink truncate</li><li></li><li> mkdir rmdir</li><li></li><li> utime chmod chown</li><li></li><li> fcntl -- not strictly filesys related, but possibly as dangerous?</li></ol></pre></li>
<li><a name="%3asubprocess"></a><b>:subprocess</b>
<pre class="verbatim"><ol><li> <span class="w">backtick</span> <a class="l_k" href="functions/system.html">system</a></li><li></li><li> <a class="l_k" href="functions/fork.html">fork</a></li><li></li><li> <a class="l_k" href="functions/wait.html">wait</a> <a class="l_k" href="functions/waitpid.html">waitpid</a></li><li></li><li> <a class="l_k" href="functions/glob.html">glob</a> -- <span class="w">access</span> <span class="w">to</span> <span class="w">Cshell</span> <span class="w">via</span> <span class="q"><`rm *`></span></li></ol></pre></li>
<li><a name="%3aownprocess"></a><b>:ownprocess</b>
<pre class="verbatim"><ol><li> exec exit kill</li><li></li><li> time tms -- could be used for timing attacks (paranoid?)</li></ol></pre></li>
<li><a name="%3aothers"></a><b>:others</b>
<p>This tag holds groups of assorted specialist opcodes that don't warrant
having optags defined for them.</p>
<p>SystemV Interprocess Communications:</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/msgctl.html">msgctl</a> <a class="l_k" href="functions/msgget.html">msgget</a> <a class="l_k" href="functions/msgrcv.html">msgrcv</a> <a class="l_k" href="functions/msgsnd.html">msgsnd</a></li><li></li><li> <a class="l_k" href="functions/semctl.html">semctl</a> <a class="l_k" href="functions/semget.html">semget</a> <a class="l_k" href="functions/semop.html">semop</a></li><li></li><li> <a class="l_k" href="functions/shmctl.html">shmctl</a> <a class="l_k" href="functions/shmget.html">shmget</a> <a class="l_k" href="functions/shmread.html">shmread</a> <a class="l_k" href="functions/shmwrite.html">shmwrite</a></li></ol></pre></li>
<li><a name="%3aload"></a><b>:load</b>
<p>This tag holds opcodes related to loading modules and getting information
about calling environment and args.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/require.html">require</a> <span class="w">dofile</span> </li><li> <a class="l_k" href="functions/caller.html">caller</a></li></ol></pre></li>
<li><a name="%3astill_to_be_decided"></a><b>:still_to_be_decided</b>
<pre class="verbatim"><ol><li> chdir</li><li> flock ioctl</li><li></li><li> socket getpeername ssockopt</li><li> bind connect listen accept shutdown gsockopt getsockname</li><li></li><li> sleep alarm -- changes global timer state and signal handling</li><li> sort -- assorted problems including core dumps</li><li> tied -- can be used to access object implementing a tie</li><li> pack unpack -- can be used to create/use memory pointers</li><li></li><li> entereval -- can be used to hide code from initial compile</li><li></li><li> reset</li><li></li><li> dbstate -- perl -d version of nextstate(ment) opcode</li></ol></pre></li>
<li><a name="%3adangerous"></a><b>:dangerous</b>
<p>This tag is simply a bucket for opcodes that are unlikely to be used via
a tag name but need to be tagged for completeness and documentation.</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/syscall.html">syscall</a> <a class="l_k" href="functions/dump.html">dump</a> <a class="l_k" href="functions/chroot.html">chroot</a></li></ol></pre></li>
</ul>
<a name="SEE-ALSO"></a><h1>SEE ALSO</h1>
<p><a href="ops.html">ops</a> -- perl pragma interface to Opcode module.</p>
<p><a href="Safe.html">Safe</a> -- Opcode and namespace limited execution compartments</p>
<a name="AUTHORS"></a><h1>AUTHORS</h1>
<p>Originally designed and implemented by Malcolm Beattie,
mbeattie@sable.ox.ac.uk as part of Safe version 1.</p>
<p>Split out from Safe module version 1, named opcode tags and other
changes added by Tim Bunce.</p>
<div id="page_index">
<div id="page_index_header">
<div id="page_index_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
<div id="page_index_title"><span class="page_index_top">Page index</span></div>
<div id="page_index_topright"></div>
</div>
<div id="page_index_content">
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#NOTE">NOTE</a><li><a href="#WARNING">WARNING</a><li><a href="#Operator-Names-and-Operator-Lists">Operator Names and Operator Lists</a><li><a href="#Opcode-Functions">Opcode Functions</a><li><a href="#Manipulating-Opsets">Manipulating Opsets</a><li><a href="#TO-DO-(maybe)">TO DO (maybe)</a><li><a href="#Predefined-Opcode-Tags">Predefined Opcode Tags</a><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#AUTHORS">AUTHORS</a></ul>
</div>
<div id="page_index_footer">
<div id="page_index_bottomleft"></div>
<div id="page_index_bottom"><span class="page_index_bottom"></span></div>
<div id="page_index_resize"></div>
</div>
</div>
</div>
<div id="content_footer">
</div>
</div>
<div id="right_column">
<div class="side_group">
<div class="side_panel tools_panel">
<p>Recently read</p>
<div id="recent_pages"></div>
</div>
<div class="side_panel tools_panel">
<p>Tools</p>
<ul>
<li><a href="preferences.html">Preferences</a>
</ul>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="footer">
<div id="footer_content">
</div>
</div>
</div>
<script language="JavaScript" src="static/combined-20090809.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
perldoc.setPath(0);
perldoc.pageName = 'Opcode';
perldoc.pageAddress = 'Opcode.html';
perldoc.contentPage = 1;
</script>
</body>
</html>
|