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]

Re: Using systemtap for rewriting syscalls?


Hi Josh,

> global mocked;
> probe kernel.function("vfs_fstatat").call {
>   if (user_string($filename) == "/path/to/bad/dir") {
>     mocked[tid()] = 1;  // remember for the .return
>     $stat->dev = 123;
>     $stat->ino = 456;
>     // ...
>     $flag = -1;  // bad flag bits will trigger EINVAL
>   }
> }
> probe kernel.function("vfs_fstatat").return {
>   if (tid() in mocked) {
>     delete mocked[tid()];
>     $return = 0; // mock success!
>   }
> }
>

Thanks, this is exactly what I was looking for!

Unfortunately, I was not able to try it out due to missing "debuginfo"
package in the repos, so in the end I had to reboot anyway. But I'll
keep it in the toolbox in case the same issue happens again.

Thank you very much!

Riccardo

--
Riccardo Murri
http://www.s3it.uzh.ch/about/team/#Riccardo.Murri

S3IT: Services and Support for Science IT
University of Zurich
Winterthurerstrasse 190, CH-8057 ZÃrich (Switzerland)

Tel: +41 44 635 4208
Fax: +41 44 635 6888


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