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] Modify flag's value in tapset's probe delete_module


Hi, everyone

In the probe delete_module(syscalls.stp), function _module_flags_str
 (aux_syscalls.stp) is used for converting the flags to string. But the
 returned string is different from the man page of delete_module:

delete_module's flag values in "man delete_module"(RHEL5,IA64) is O_TRUNC
 and O_NONBLOCK, but in probe delete_module, flag's value is WAIT and FORCE
 (From other non-intel-arch?).

Is there anyone knows why tapset uses WAIT/FORCE values for delete_module's
 flag, please tell me(or I will modify it unify with man).

And there may be another problem exists in delete_module's probe:
O_TRUNC and O_NONBLOCK's value is different between architectures, so I
 think it is better using defined value for compare with flag's value.
 (It we use static value as 2048/512, it will get different result across
 architectures):

I write a patch for this problem:
and if no objection, I will commit it.

Signed-off-by: "Zhaolei" zhaolei@cn.fujitsu.com

function _module_flags_str:string(flags:long)
--- aux_syscalls.stp.old 2007-08-24 15:35:05.000000000 +0900
+++ aux_syscalls.stp 2007-08-24 15:34:44.000000000 +0900
@@ -1131,11 +1131,19 @@ function _mlockall_flags_str:string(flag
 %}
 
 /* used by sys_delete_module */
-function _module_flags_str(f) { 
-   if(!(f & 2048)) bs="WAIT|"
-   if(f & 512) bs=bs."FORCE|"
-   return substr(bs,0,strlen(bs)-1)
-}
+function _module_flags_str:string(flags:long)
+%{ /* pure */
+ int len;
+ long flags = THIS->flags;
+ char *str = THIS->__retvalue;
+ if (flags & O_TRUNC)
+  strlcat(str,"O_TRUNC|", MAXSTRINGLEN);
+ if (flags & O_NONBLOCK)
+  strlcat(str,"O_NONBLOCK|", MAXSTRINGLEN);
+        len = strlen(str);
+        if (len)
+                str[strlen(str)-1] = 0;
+%}
 
 function _sched_policy_str(policy) {
    if(policy==0) return "SCHED_OTHER"

Regards
Zhaolei


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