Re: Wrapping FastCGI - Function howto?
Jeremy Cowgar wrote:
>
> Hey guys,
>
> I am trying to wrap fast cgi and here's the C signature:
>
> DLLAPI int FCGX_Accept(
> FCGX_Stream **in,
> FCGX_Stream **out,
> FCGX_Stream **err,
> FCGX_ParamArray *envp);
>
> DLLAPI is nothing on Unix (where I am testing right now).
>
> I wrapped it as:
>
> }}}
<eucode>
> constant hAccept = define_c_func(hFcgi, "FCGX_Accept", {P, P, P, P}, I),
>
> global function FCGX_Accept()
> integer result
> atom pIn, pOut, pErr, pEnv
>
> pIn = allocate(4)
> pOut = allocate(4)
> pErr = allocate(4)
> pEnv = allocate(4)
>
> if c_func(hAccept, {pIn, pOut, pErr, pEnv}) >= 0 then
> return {pIn, pOut, pErr, pEnv}
> end if
>
> return 0
> end function
> </eucode>
{{{
>
> Does that seem right? When I call this function on 3.2, I immediately get a
> machine level error when calling hAccept. On released 3.1, I get a glibc
> memory
> error:
>
> *** glibc detected *** exu: malloc(): memory corruption: 0x080e9990 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0xb7eaac64]
> /lib/libc.so.6[0xb7ead22a]
> /lib/libc.so.6(__libc_malloc+0x9c)[0xb7eae9ec]
> /lib/libc.so.6[0xb7e9b7af]
> /lib/libc.so.6(fopen+0x2c)[0xb7e9b87c]
> exu[0x8086650]
> /usr/lib/libfcgi.so(FCGX_PutS+0x35)[0xb7e39345]
> exu[0x8079feb]
> exu[0x807c93b]
> ======= Memory map: ========
> 08048000-08090000 r-xp 00000000 08:01 22003817 /opt/euphoria-3.1/bin/exu
> 08090000-08091000 rwxp 00048000 08:01 22003817 /opt/euphoria-3.1/bin/exu
> 08091000-08102000 rwxp 08091000 00:00 0 [heap]
> b7d00000-b7d21000 rwxp b7d00000 00:00 0
> b7d21000-b7e00000 ---p b7d21000 00:00 0
> b7e12000-b7e1e000 r-xp 00000000 08:01 639287 /usr/lib/libgcc_s.so.1
> b7e1e000-b7e1f000 rwxp 0000b000 08:01 639287 /usr/lib/libgcc_s.so.1
> b7e1f000-b7e32000 r-xp 00000000 08:01 10207268 /lib/libnsl-2.7.so
> b7e32000-b7e34000 rwxp 00012000 08:01 10207268 /lib/libnsl-2.7.so
> b7e34000-b7e36000 rwxp b7e34000 00:00 0
> b7e36000-b7e3e000 r-xp 00000000 08:01 6963639 /usr/lib/libfcgi.so.0.0.0
> b7e3e000-b7e3f000 rwxp 00008000 08:01 6963639 /usr/lib/libfcgi.so.0.0.0
> b7e3f000-b7e40000 rwxp b7e3f000 00:00 0
> b7e40000-b7f7a000 r-xp 00000000 08:01 10207256 /lib/libc-2.7.so
> b7f7a000-b7f7b000 r-xp 0013a000 08:01 10207256 /lib/libc-2.7.so
> b7f7b000-b7f7d000 rwxp 0013b000 08:01 10207256 /lib/libc-2.7.so
> b7f7d000-b7f80000 rwxp b7f7d000 00:00 0
> b7f80000-b7f82000 r-xp 00000000 08:01 10207260 /lib/libdl-2.7.so
> b7f82000-b7f84000 rwxp 00001000 08:01 10207260 /lib/libdl-2.7.so
> b7f84000-b7fa8000 r-xp 00000000 08:01 10207266 /lib/libm-2.7.so
> b7fa8000-b7faa000 rwxp 00023000 08:01 10207266 /lib/libm-2.7.so
> b7faa000-b7fab000 rwxp b7faa000 00:00 0
> b7fbf000-b7fc0000 r-xp b7fbf000 00:00 0 [vdso]
> b7fc0000-b7fdb000 r-xp 00000000 08:01 10208712 /lib/ld-2.7.so
> b7fdb000-b7fdd000 rwxp 0001a000 08:01 10208712 /lib/ld-2.7.so
> bfb3d000-bfb52000 rw-p bffeb000 00:00 0 [stack]
>
> Any thoughts?
>
> --
Jeremy:
pEnv should be just a pointer not a allocated location
pEnv = allocate(4)
Bernie
My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API
Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
|
Not Categorized, Please Help
|
|