Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#120 Exit Interface Func disappeared after exiting child Rexx

v4.0
closed
nobody
APIs (66)
5
2012-08-14
2006-01-10
Toshio
No

Our application calls another Rexx as a child process.
After the child Rexx process exited, the main Rexx
process cannot find any registered "Exit Interface
Function".
Then, we got a "Failure in system service" error.

Environment: Redhat Enterprise Linux 4 AS for IA32
Version: ooRexx-3.0.0-1

Sample code:
---callsample.c--------

include <stdio.h>

define INCL_REXXSAA

include <rexx.h>

static LONG RexxIO0(
LONG ExitNumber,
LONG Subfunction,
PEXIT parmblock)
{
/ dummy /
printf("* ");
}

int main()
{
APIRET rc = 0;
LONG rexxrc = 0;
RXSTRING rexxretval;
rexxretval.strptr = NULL;
rexxretval.strlength = 0;
RXSYSEXIT exitlist[9];

rc = RexxRegisterExitExe("RexxIO",
                         (PFN)&RexxIO0,
                         (PUCHAR)NULL);
exitlist[0].sysexit_name = "RexxIO";
exitlist[0].sysexit_code = RXSIO;
exitlist[1].sysexit_code = RXENDLST;

rc=REXXSTART(
        (LONG)       0,
        (PRXSTRING)  NULL,
        (PSZ)        "l1.rex",
        (PRXSTRING)  NULL,
        (PSZ)        "bash",
        (LONG)       RXCOMMAND,
        (PRXSYSEXIT) exitlist,
        (PSHORT)     &rexxrc,
        (PRXSTRING)  &rexxretval );

}

---- l1.rex ---------------------
say "before calling $rexx l2.rex"
"rexx l2.rex"
say "after calling $rexx l2.rex"
-------------------------------
---- l2.rex ---------------------
call RxFuncAdd 'PdLoadFuncs', 'pduxlib', 'PdLoadFuncs'
call PdLoadFuncs
/ dummy loading /
say "HELLO!!"
-------------------------------

Result:
$ gcc -o callsample callsample.c -lpthread -ldl \ -L/usr/local/lib/ooRexx -lrexx -lrexxapi \ -I/usr/local/include
$ ./callsample
before calling $rexx l2.rex
HELLO!!
3
-* say "after calling $rexx l2.rex"
REX0048E: Error 48
running /home/aliss/aliss/problem/l1.rex line 3:
Failure in system service
REX0425E: Error 48.1: Failure in system service:
RexxIO
$

Additional Information:
It seems RxFreeAPIBlock() deletes all entries of both
child and main Rexx processes.

Discussion

  • Rick McGuire
    Rick McGuire
    2006-01-11

    Logged In: YES
    user_id=1125291

    Exits registered via RexxRegisterExitExe are only valid in
    the process that registers the entry point. Once that
    process terminates, the registered exits are cleaned up.
    RexxRegisterExitDll needs to be used for registrations that
    require cross-process visibility.

     
  • Toshio
    Toshio
    2006-01-12

    Logged In: YES
    user_id=1413481

    Thank you for your reply, but I don't agree with your
    opinion.

    I didn't use the exit function in cross-process.
    The error occurred in the third line of "l1.rex".
    The process hadn't terminated.

    say "before calling $rexx l2.rex"
    "rexx l2.rex"
    say "after calling $rexx l2.rex" <===

    Why did child rexx process clean up the registry of main
    process?

    By the way, sorry, "l2.rex" is incomplete. It contains our
    library. It should be,
    ----l2.rex----
    call RxFuncAdd 'SysLoadFuncs', 'rexxutil', 'SysLoadFuncs'
    call SysLoadFuncs
    / dummy loading /

    say "HELLO!!"

     
  • Rick McGuire
    Rick McGuire
    2006-01-12

    Logged In: YES
    user_id=1125291

    Sorry, I misunderstood the error scenario. The API code is
    getting a complete rewrite in the next release, so we'll
    make sure this sample works correctly in the next release.

     
  • Mark Miesfeld
    Mark Miesfeld
    2009-07-02

    This bug wasn't fixed in 3.2.0, but it is now fixed in 4.0.0

    I'll attach a zip file containing the test programs if anyone is interested in trying them. Instructions for compiling the C files for either Linux or Windows are in the header of the C file.

     


Anonymous


Cancel   Add attachments