0

I'm using the following DTrace script to follow the read and write syscalls of bash:

syscall::write:entry,
syscall::read:entry
/execname == "bash"/
{

}

It successfully matches 2 probes, but no matter what I type, I only see the read calls. No write calls are ver reported. I was expecting to get write calls when the shell echos back to screen.

Is the script wrong, or am I under the wrong assumptions of how bash works?

I'm running under OSX Mountain Lion

1
  • Do you see them if you define them separately w/o using comma?
    – Eimantas
    Apr 6, 2013 at 12:31

1 Answer 1

1

Try with a wildcard after "write". This will list the matching probes:

sudo dtrace -l -n 'syscall::write*:entry'

And this will probably get you the output you expect:

syscall::write*:entry,
syscall::read*:entry
/execname == "bash"/
{

}

The call being used is probably write_nocancel.

2
  • 1
    There's not much out there. Apple has a release note titled Symbol Variants: Why Those Dollar Signs? the mentions symbol variants with a $NOCANCEL suffix. Those are the library cover functions, but the syscalls they wrap actually have a _nocancel suffix. All it says about them, though, is "used internally". I believe they're related to pthread cancellation. Apr 6, 2013 at 19:48
  • Thanks! I was amazed I couldn't find almost any mention on google.
    – cfischer
    Apr 7, 2013 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.