This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch]Improve retstr of syscall.adjtimex.return in tapset


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]