* [Patch]Add function for probe point sunrpc.clnt.create_client
@ 2007-09-20 15:05 Cai Fei
2007-09-21 12:16 ` [Patch]Improve retstr of syscall.adjtimex.return in tapset Zhaolei
0 siblings, 1 reply; 3+ messages in thread
From: Cai Fei @ 2007-09-20 15:05 UTC (permalink / raw)
To: systemtap
Hi, all
I found that probe point sunrpc.clnt.create_client does not work
properly on RHEL5.
The reason is that when a rpc client is created, the kernel function be
called is not
rpc_create_client, but rpc_new_client.
On RHEL5, rpc_create_client and rpc_new_client both exists. And in the
latest
kernel, rpc_create_client does not exist any more. So it's necessary to
add rpc_new_client
to the tapset.
The patch is as below:
diff -Nur systemtap-20070915.orig/tapset/rpc.stp systemtap-20070915/tapset/rpc.stp
--- systemtap-20070915.orig/tapset/rpc.stp 2007-09-20 11:59:27.000000000 +0900
+++ systemtap-20070915/tapset/rpc.stp 2007-09-20 12:21:40.000000000 +0900
@@ -56,6 +56,11 @@
* rpc_create_client(struct rpc_xprt *xprt, char *servname,
* struct rpc_program *info, u32 version,
* rpc_authflavor_t authflavor)
+ *
+ * static struct rpc_clnt *
+ * rpc_new_client(struct rpc_xprt *xprt, char *servname,
+ * struct rpc_program *program, u32 vers,
+ * rpc_authflavor_t flavor)
*
* @servername: the server machine name
* @progname: the RPC program name
@@ -65,10 +70,20 @@
* @port: the port number
* @authflavor: the authentication flavor
*/
-probe sunrpc.clnt.create_client = kernel.function("rpc_create_client") ?,
- module("sunrpc").function("rpc_create_client") ?
+probe sunrpc.clnt.create_client = _sunrpc.clnt.create_client.*
{
servername = kernel_string($servname)
+ prot = $xprt->prot
+ port = $xprt->port
+
+ argstr = sprintf("%s %s %d %d %d %d %d", servername, progname,
+ prog, vers, prot, port, authflavor)
+}
+
+probe _sunrpc.clnt.create_client.part1 = kernel.function("rpc_create_client") ?,
+ module("sunrpc").function("rpc_create_client") ?
+{
+ name = "sunrpc.clnt.create_client"
%( kernel_v >= "2.6.10" %?
progname = kernel_string($info->name)
prog = $info->number
@@ -80,21 +95,35 @@
vers = vers_from_prog($program, $vers)
authflavor = $flavor
%)
-
- prot = $xprt->prot
- port = $xprt->port
+}
- name = "sunrpc.clnt.create_client"
- argstr = sprintf("%s %s %d %d %d %d %d", servername, progname,
- prog, vers, prot, port, authflavor)
+probe _sunrpc.clnt.create_client.part2 = kernel.function("rpc_new_client") ?,
+ module("sunrpc").function("rpc_new_client") ?
+{
+ name = "sunrpc.clnt.new_client"
+ progname = kernel_string($program->name)
+ prog = $program->number
+ vers = vers_from_prog($program, $vers)
+ authflavor = $flavor
}
-probe sunrpc.clnt.create_client.return =
+probe sunrpc.clnt.create_client.return = _sunrpc.clnt.create_client.return.*
+{
+ retstr = returnstr($return)
+}
+
+probe _sunrpc.clnt.create_client.return.part1 =
kernel.function("rpc_create_client").return ?,
- module("sunrpc").function("rpc_create_client").return ?
+ module("sunrpc").function("rpc_create_client").return ?
{
name = "sunrpc.clnt.create_client.return"
- retstr = returnstr($return)
+}
+
+probe _sunrpc.clnt.create_client.return.part2 =
+ kernel.function("rpc_new_client").return ?,
+ module("sunrpc").function("rpc_new_client").return ?
+{
+ name = "sunrpc.clnt.new_client.return"
}
/*
Regards, CaiFei
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Patch]Improve retstr of syscall.adjtimex.return in tapset
2007-09-20 15:05 [Patch]Add function for probe point sunrpc.clnt.create_client Cai Fei
@ 2007-09-21 12:16 ` Zhaolei
2007-09-21 16:33 ` Martin Hunt
0 siblings, 1 reply; 3+ messages in thread
From: Zhaolei @ 2007-09-21 12:16 UTC (permalink / raw)
To: systemtap; +Cc: Zhaolei
Hi, everyone
In kernel, adjtimex syscall's return value have following types:
#define TIME_OK 0 /* clock synchronized */
#define TIME_INS 1 /* insert leap second */
#define TIME_DEL 2 /* delete leap second */
#define TIME_OOP 3 /* leap second in progress */
#define TIME_WAIT 4 /* leap second has occurred */
#define TIME_BAD 5 /* clock not synchronized */
Current version of tapset can only display return value's error string, and
display only digital number when return value have other meaning.
For example, when call adjtimex twice(return 5 and -14)
Current version of stap's retstr is like:
5
-14 (EFAULT)
I think is may be a good idea to print return value's type string in retstr
like following:
5 (TIME_BAD)
-14 (EFAULT)
If no objection, I will commit this patch:
Signed-off-by: "Zhaolei" zhaolei@cn.fujitsu.com
diff -up old/aux_syscalls.stp new/aux_syscalls.stp
--- old/aux_syscalls.stp 2007-08-30 16:24:49.000000000 +0900
+++ new/aux_syscalls.stp 2007-08-30 16:23:44.000000000 +0900
@@ -1750,3 +1750,35 @@ function _at_flag_str(f) {
if (f == 0x100) return "AT_SYMLINK_NOFOLLOW"
return sprintf("0x%x", f)
}
+
+function _adjtimex_return_str(ret) {
+ if ( ret == 0 )
+ {
+ return sprintf("%d %s", ret, "(TIME_OK)")
+ }
+ if ( ret == 1 )
+ {
+ return sprintf("%d %s", ret, "(TIME_INS)")
+ }
+ if ( ret == 2 )
+ {
+ return sprintf("%d %s", ret, "(TIME_DEL)")
+ }
+ if ( ret == 3 )
+ {
+ return sprintf("%d %s", ret, "(TIME_OOP)")
+ }
+ if ( ret == 4 )
+ {
+ return sprintf("%d %s", ret, "(TIME_WAIT)")
+ }
+ if ( ret == 5 )
+ {
+ return sprintf("%d %s", ret, "(TIME_BAD)")
+ }
+ return returnstr(1)
+}
+
diff -up old/syscalls.stp new/syscalls.stp
--- old/syscalls.stp 2007-08-30 16:24:34.000000000 +0900
+++ new/syscalls.stp 2007-08-30 16:23:51.000000000 +0900
@@ -113,7 +113,7 @@ probe syscall.adjtimex = kernel.function
}
probe syscall.adjtimex.return = kernel.function("sys_adjtimex").return {
name = "adjtimex"
- retstr = returnstr(1)
+ retstr = _adjtimex_return_str($return)
}
# long compat_sys_adjtimex(struct compat_timex __user *utp)
Regards
Zhaolei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch]Improve retstr of syscall.adjtimex.return in tapset
2007-09-21 12:16 ` [Patch]Improve retstr of syscall.adjtimex.return in tapset Zhaolei
@ 2007-09-21 16:33 ` Martin Hunt
0 siblings, 0 replies; 3+ messages in thread
From: Martin Hunt @ 2007-09-21 16:33 UTC (permalink / raw)
To: Zhaolei; +Cc: systemtap
On Fri, 2007-09-21 at 16:06 +0900, Zhaolei wrote:
> Hi, everyone
>
> In kernel, adjtimex syscall's return value have following types:
> #define TIME_OK 0 /* clock synchronized */
> #define TIME_INS 1 /* insert leap second */
> #define TIME_DEL 2 /* delete leap second */
> #define TIME_OOP 3 /* leap second in progress */
> #define TIME_WAIT 4 /* leap second has occurred */
> #define TIME_BAD 5 /* clock not synchronized */
>
> Current version of tapset can only display return value's error string, and
> display only digital number when return value have other meaning.
> For example, when call adjtimex twice(return 5 and -14)
> Current version of stap's retstr is like:
> 5
> -14 (EFAULT)
>
> I think is may be a good idea to print return value's type string in retstr
> like following:
> 5 (TIME_BAD)
> -14 (EFAULT)
This is a good idea.
> If no objection, I will commit this patch:
>
> Signed-off-by: "Zhaolei" zhaolei@cn.fujitsu.com
>
> diff -up old/aux_syscalls.stp new/aux_syscalls.stp
> --- old/aux_syscalls.stp 2007-08-30 16:24:49.000000000 +0900
> +++ new/aux_syscalls.stp 2007-08-30 16:23:44.000000000 +0900
> @@ -1750,3 +1750,35 @@ function _at_flag_str(f) {
> if (f == 0x100) return "AT_SYMLINK_NOFOLLOW"
> return sprintf("0x%x", f)
> }
> +
> +function _adjtimex_return_str(ret) {
> + if ( ret == 0 )
> + {
> + return sprintf("%d %s", ret, "(TIME_OK)")
> + }
> + if ( ret == 1 )
> + {
> + return sprintf("%d %s", ret, "(TIME_INS)")
> + }
> + if ( ret == 2 )
> + {
> + return sprintf("%d %s", ret, "(TIME_DEL)")
> + }
> + if ( ret == 3 )
> + {
> + return sprintf("%d %s", ret, "(TIME_OOP)")
> + }
> + if ( ret == 4 )
> + {
> + return sprintf("%d %s", ret, "(TIME_WAIT)")
> + }
> + if ( ret == 5 )
> + {
> + return sprintf("%d %s", ret, "(TIME_BAD)")
> + }
> + return returnstr(1)
> +}
or a bit simpler:
function _adjtimex_return_str(ret) {
if (ret == 0)
val = "OK"
else if (ret == 1)
val = "INS"
else if (ret == 2)
val = "DEL"
else if (ret == 3)
val = "OOP"
else if (ret == 4)
val = "WAIT"
else if (ret == 5)
val = "BAD"
if (val != "")
return sprintf("%d (TIME_%s)", ret, val)
else
return returnstr(1)
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-21 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-20 15:05 [Patch]Add function for probe point sunrpc.clnt.create_client Cai Fei
2007-09-21 12:16 ` [Patch]Improve retstr of syscall.adjtimex.return in tapset Zhaolei
2007-09-21 16:33 ` Martin Hunt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).