diff options
author | Josh Stone <jistone@redhat.com> | 2009-04-29 14:00:21 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-04-29 14:00:21 -0700 |
commit | 0904184b479723cc514db320f7cb70b8c284ea1a (patch) | |
tree | 4a1e406d8fab63abec3cb4d6b48b06ecdf5f381f /testsuite/systemtap.base/cast.stp | |
parent | 999740348b95d993cbe36b9283c5cb7ee7bda149 (diff) | |
download | systemtap-steved-0904184b479723cc514db320f7cb70b8c284ea1a.tar.gz systemtap-steved-0904184b479723cc514db320f7cb70b8c284ea1a.tar.xz systemtap-steved-0904184b479723cc514db320f7cb70b8c284ea1a.zip |
Use sockaddr instead of timeval in @cast test
Using timeval had problems on big-endian multi-arch platforms (ppc64),
because the user tv_sec used in the @cast didn't match the kernel tv_sec
used to provide a pointer. Hopefully reading from a sockaddr should be
more robust, as that type doesn't appear to need any compat wrappers for
multi-archs.
Diffstat (limited to 'testsuite/systemtap.base/cast.stp')
-rw-r--r-- | testsuite/systemtap.base/cast.stp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp index 6298a06d..e2505000 100644 --- a/testsuite/systemtap.base/cast.stp +++ b/testsuite/systemtap.base/cast.stp @@ -25,19 +25,23 @@ probe begin else printf("execname \"%s\" != \"%s\"\n", name, cast_name) - // Compare tv_sec using a generated user module - sec = 42 - cast_sec = @cast(get_timeval(sec), "timeval", "<sys/time.h>")->tv_sec - if (sec == cast_sec) - println("tv_sec OK") + // Compare sa_data using a generated user module + data = 42 + cast_data = @cast(get_sockaddr(data), "sockaddr", "<sys/socket.h>")->sa_data[0] + if (data == cast_data) + println("sa_data OK") else - printf("tv_sec %d != %d\n", sec, cast_sec) + printf("sa_data %d != %d\n", data, cast_data) exit() } -function get_timeval:long(sec:long) %{ - static struct timeval mytime = {0}; - mytime.tv_sec = THIS->sec; - THIS->__retvalue = (long)&mytime; +%{ +#include <linux/socket.h> +%} + +function get_sockaddr:long(data:long) %{ + static struct sockaddr sa = {0}; + sa.sa_data[0] = THIS->data; + THIS->__retvalue = (long)&sa; %} |