[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 30 14:44:03 2003 
Subject:Re: 'errno' problem for poplog in redhat 9: Partial progress 
From:Waldek Hebisch 
Volume-ID:1030630.03 

Suspecting stack corraption i slightly modified what Aaron Sloman wrote:
: Step 1:
: Put Waldek's two C procedures in
:     $popexternlib/c_core.c
 
:      int get_libc_errno(void)
:      {
:              return errno;
:      }
 
:      void set_libc_errno(int x)
:      {
:              errno = x;
:      }

changed to 

int set_libc_errno(int x)
{
        errno = x;
        return 0;
}


: and run mklibpop to compile them and build the library
:     $popexternlib/libpop.a
 
: Step 2:
: Put an active variable definition in $popsrc/errors.p to
: invoke those two C programs.
 
:  define active DO_ERRNO_VAL() -> _x;
:      _extern get_libc_errno() -> _x
:  enddefine;


:  define updaterof active DO_ERRNO_VAL(_x);
:      _extern set_libc_errno(_x)
:  enddefine;

changed to:

define updaterof active DO_ERRNO_VAL(_x);
     lvars _dummy;
     _extern set_libc_errno(_x) -> _dummy
enddefine;

: Also make sure that this is declared in
:     $popsrc/declare.ph
 
: So that it is available for all system sources:
 
:  global constant
:      active
:                  DO_ERRNO_VAL
:      ;

<snip>

: Step 3: Alter the definition of the macro in
:     $popsrc/unixdefs.ph
: to invoke the active variable
 
:     lconstant macro _ERRNO = [DO_ERRNO_VAL];
 
: (note that the _extern has moved to inside the procedure definitions
: and is not needed here.)
 
: Finally: recompile all the system sources and relink
 
:     In $popsrc
 
:         pgcomp *.p
:         pglibr -r ../obj/src.wlb *.w
:         rm *.w *.o
 
:     In $usepop/pop/ved/src
 
:         pgcomp *.p
:         pglibr -r ../obj/vedsrc.wlb *.w
:         rm *.w *.o
 
:     In $usepop/pop/x/src
 
:         pgcomp *.p
:         pglibr -r ../obj/xsrc.wlb *.w
:         rm *.w *.o
 
: Then in some temporary directory:
 
:     pglink
 
: That creates a bunch of poplink* files (including the poplink_cmnd
: that does the linking) and creates from them an executable
:     newpop11
 
: Try it:

It seems to work OK, at least the mishaps and weird error messages 
which appeared prevoiusly are gone.

--
                              Waldek Hebisch
hebisch@math.uni.wroc.pl    or hebisch@hera.math.uni.wroc.pl