~ubuntu-branches/ubuntu/lucid/rsyslog/lucid-updates

« back to all changes in this revision

Viewing changes to runtime/vm.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-06-23 12:12:43 UTC
  • mfrom: (1.1.11 upstream) (3.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20090623121243-d2fejarzidywnn17
Tags: 4.2.0-1
* New upstream release of the now stable v4 branch.
  - Fix warnings when /etc/rsyslog.d/ is empty. Closes: #530228
* debian/patches/imudp_multiple_udp_sockets.patch
  - Removed, merged upstream.
* debian/rsyslog.default
  - Set default compat mode to '4'.
* debian/rsyslog.logcheck.ignore.server
  - Update logcheck rules files to also ignore rsyslogd and imklog stop
    messages.
* debian/control
  - Bump Standards-Version to 3.8.2. No further changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#include "config.h"
27
27
#include <stdlib.h>
 
28
#include <string.h>
28
29
#include <assert.h>
29
30
 
30
31
#include "rsyslog.h"
331
332
ENDop(PUSHSYSVAR)
332
333
 
333
334
 
 
335
/* The function call operation is only very roughly implemented. While the plumbing
 
336
 * to reach this instruction is fine, the instruction itself currently supports only
 
337
 * functions with a single argument AND with a name that we know.
 
338
 * TODO: later, we can add here the real logic, that involves looking up function
 
339
 * names, loading them dynamically ... and all that...
 
340
 * implementation begun 2009-03-10 by rgerhards
 
341
 */
 
342
BEGINop(FUNC_CALL) /* remember to set the instruction also in the ENDop macro! */
 
343
        var_t *numOperands;
 
344
        var_t *operand1;
 
345
        int iStrlen;
 
346
CODESTARTop(FUNC_CALL)
 
347
        vmstk.PopNumber(pThis->pStk, &numOperands);
 
348
        if(numOperands->val.num != 1)
 
349
                ABORT_FINALIZE(RS_RET_INVLD_NBR_ARGUMENTS);
 
350
        vmstk.PopString(pThis->pStk, &operand1); /* guess there's just one ;) */
 
351
        if(!rsCStrSzStrCmp(pOp->operand.pVar->val.pStr, (uchar*) "strlen", 6)) { /* only one supported so far ;) */
 
352
RUNLOG_VAR("%s", rsCStrGetSzStr(operand1->val.pStr));
 
353
                iStrlen = strlen((char*) rsCStrGetSzStr(operand1->val.pStr));
 
354
RUNLOG_VAR("%d", iStrlen);
 
355
        } else
 
356
                ABORT_FINALIZE(RS_RET_INVLD_FUNC);
 
357
        PUSHRESULTop(operand1, iStrlen); // TODO: dummy, FIXME
 
358
        var.Destruct(&numOperands); /* no longer needed */
 
359
finalize_it:
 
360
ENDop(FUNC_CALL)
 
361
 
 
362
 
334
363
/* ------------------------------ end instruction set implementation ------------------------------ */
335
364
 
336
365
 
412
441
                        doOP(DIV);
413
442
                        doOP(MOD);
414
443
                        doOP(UNARY_MINUS);
 
444
                        doOP(FUNC_CALL);
415
445
                        default:
416
446
                                ABORT_FINALIZE(RS_RET_INVALID_VMOP);
417
447
                                dbgoprint((obj_t*) pThis, "invalid instruction %d in vmprg\n", pCurrOp->opcode);