Sunday, June 26, 2011

Why I Hate My Mac...

I've had my MacBook for a few years now and I keep running into the same problem:
ariel@bloodchoke$ sudo strace -p 1144
sudo: strace: command not found
ariel@bloodchoke$ sudo /usr/sbin/strace -p 1144
sudo: /usr/sbin/strace: command not found
ariel@bloodchoke$ brew install strace
Error: No available formula for strace


UPDATE: I no longer hate my Mac, I am just frustrated with it. Thanks to Jim Nicholson for pointing out that FreeBSD offers a similar utility called truss. Brendan Gregg created a version of truss for the Mac that is built on dtrace.
Running it on the EventMachine tutorial "echo server", this is what I say...
ariel@bloodchoke$ sudo dtruss -f -p 200 
......
200/0x446:  select(0x7, 0x7FFF5FBFD6E4, 0x7FFF5FBFD764, 0x7FFF5FBFD7E4, 0x7FFF5FBFD868)   = 1 0
  200/0x446:  read(0x6, "afdnasklfasnm;fdas\n\0", 0x4000)   = 19 0
dtrace: error on enabled probe ID 1770 (ID 18322: syscall::read:return): out of scratch space in action #13 at DIF offset 44
  200/0x446:  sigprocmask(0x1, 0x0, 0x7FFF5FBFD600)   = 0x0 0
  200/0x446:  sigaltstack(0x0, 0x7FFF5FBFD5F0, 0x0)   = 0 0
  200/0x446:  select(0x7, 0x7FFF5FBFD6E4, 0x7FFF5FBFD764, 0x7FFF5FBFD7E4, 0x7FFF5FBFD868)   = 1 0
  200/0x446:  writev(0x6, 0x7FFF5FBFD580, 0x1)   = 19 0
  200/0x446:  sigprocmask(0x1, 0x0, 0x7FFF5FBFD600)   = 0x0 0
  200/0x446:  sigaltstack(0x0, 0x7FFF5FBFD5F0, 0x0)   = 0 0


There is no output file switch and there does not seem to be a way to increase system select function calls. The other thing I cannot seem to understand is why the file descriptor is nota simple integer. Using hex sucks.

No comments: