LOCK_EX is a constant function, so every use of it gets inlined at compile time. Which makes life somewhat tricky because your instrumented LOCK_EX will never get called except in an eval EXPR type call.
Comment on Re: How to instrument a "fake" subroutine?
Wrong. Please look at the source for Fcntl.pm to confirm. Devel::Profiler already has code to handle constants, but this is a beast of a different stripe entirely.
No problem. That was actually my assumption too. When I first caught this bug I thought there was something wrong with my constant-detection code. Then I looked in Fcntl.pm and saw what I was really dealing with.
Which I suppose begs the question, why is Fcntl so damn clever? Is there something wrong with just exporting a constant sub for each symbol?