Re: [PHP-DEV] return values of socket_recvmsg

  101700
January 26, 2018 19:33 samding@ca.ibm.com ("Sam Ding")
The return data in PHP is "$data" which is an array with 4 elements,
does it match to "zmsg" inside of c function
"socket_recvmsg"(/home/work/php/php/ext/sockets/sendrecvmsg.c:214)?

Here zmsg is struct with:

(gdb) ptype zmsg
type = struct _zval_struct {
    zend_value value;
    union {
        struct {...} v;
        uint32_t type_info;
    } u1;
    union {
        uint32_t next;
        uint32_t cache_slot;
        uint32_t lineno;
        uint32_t num_args;
        uint32_t fe_pos;
        uint32_t fe_iter_idx;
        uint32_t access_flags;
        uint32_t property_guard;
        uint32_t extra;
    } u2;
} *

How do these two variables match between php and C?

Thanks,

Sam

Sam Ding/Toronto/IBM wrote on 01/26/2018 09:36:00 AM:

> From: Sam Ding/Toronto/IBM > To: Kalle Sommer Nielsen <kalle@php.net> > Cc: PHP internals <internals@lists.php.net>, kalle.php@gmail.com > Date: 01/26/2018 09:36 AM > Subject: Re: [PHP-DEV] return values of socket_recvmsg > > Thank Kalle, > > I knew the implementaion of socket_recvmsg(), but want to know the > return data structure. > The test on Big_endian (s390x) got a little different return result > than on x86_64, try to dig out > where the problem is. > > Thanks, > > Sam > > > kalle.php@gmail.com wrote on 01/26/2018 01:58:23 AM: > > > From: Kalle Sommer Nielsen <kalle@php.net> > > To: Sam Ding <samding@ca.ibm.com> > > Cc: PHP internals <internals@lists.php.net> > > Date: 01/26/2018 01:58 AM > > Subject: Re: [PHP-DEV] return values of socket_recvmsg > > Sent by: kalle.php@gmail.com > > > > Hi Sam > > > > 2018-01-25 23:11 GMT+01:00 Sam Ding <samding@ca.ibm.com>: > > > > > > The test case ext/sockets/tests/socket_recvmsg.php has following output
> > > on x86_64: > > > > > > ======= > > > ... > > > 1 Array > > > 2 ( > > > 3 [name] => Array > > > 4 ( > > > 5 [family] => 10 > > > 6 [addr] => ::1 > > > 7 [port] => 7001 > > > 8 [flowinfo] => 0 > > > 9 [scope_id] => 0 > > > 10 ) > > > 11 > > > 12 [control] => Array > > > 13 ( > > > 14 [0] => Array > > > 15 ( > > > 16 [level] => 41 > > > 17 [type] => 50 > > > 18 [data] => Array > > > 19 ( > > > 20 [addr] => ::1 > > > 21 [ifindex] => 1 > > > 22 ) > > > 23 ) > > > 24 ) > > > ... > > > ======= > > > This is output by c > > > function:"socket_recvmsg"(/home/work/php/php/ext/sockets/ > sendrecvmsg.c:214), > > > > You can find the implementation of socket_recvmsg() in the ext/sockets > > directory here: > > https://urldefense.proofpoint.com/v2/url? > > > u=http-3A__git.php.net_-3Fp-3Dphp-2Dsrc.git-3Ba-3Dblob-3Bf-3Dext_sockets_sendrecvmsg.c-3Bh-3D7b9c4e8ad357b73b514dc5feb8dc8d9ca215126b-3Bhb-3DHEAD-23l210&d=DwIBaQ&c=jf_iaSHvJObTbx-
> > siA1ZOg&r=CBZ1IFMUPf-s4Wt- > > > elABGKFWisr3DNfFfWYNaKkXXUE&m=f8KTE9WyceLmQxKXG77FBkDIVqCnJ54BBnXEQuSQCo4&s=GOFChuk86IBBBORDL3I50gHrzmF4kTmYkq1qCeMufBQ&e=
> > > > > > > > -- > > regards, > > > > Kalle Sommer Nielsen > > kalle@php.net > >