[Haskell-cafe] syscall, sigpause and EINTR on Mac OSX

Joel Reymont joelr1 at gmail.com
Sun Dec 11 11:10:38 EST 2005


I'm kind of stuck on this and can't figure it out...

Take a look at the trace below, this is Mac OSX Tiger.

(gdb) where
#0  0x90006068 in syscall ()
#1  0x9004420c in sigpause ()
#2  0x001791b8 in awaitUserSignals () at Signals.c:256
#3  0x0012e1a8 in schedule (mainThread=0x1300360,  
initialCapability=0x0) at Schedule.c:518
#4  0x0012f340 in waitThread_ (m=0x1300360, initialCapability=0x0) at  
#5  0x0012f224 in scheduleWaitThread (tso=0x15c0000, ret=0x0,  
initialCapability=0x0) at Schedule.c:2050
#6  0x0012ba18 in rts_evalLazyIO (p=0x215254, ret=0x0) at RtsAPI.c:459
#7  0x0001ea7c in main (argc=4, argv=0x0) at Main.c:104
(gdb) p16 $r22
0x40:   Cannot access memory at address 0x40

My program is currently stuck here. The man pages say that sigpause  
will only terminate by being interrupted and EINTR will be the errno.  
EINTR is signal 2, the same one that I'm trapping and the one sent  
when ^C is pressed.

This probably explains why my signal handler is getting hit from time  
to time without any input from me. My program then exits and leaves  
me very puzzled as the whole thing looks like someone sneaked up to  
my keyboard and hit ^C to interrupt the program.

I'm not making any sense of this. Why would someone be calling  
sigpause and making it interrupt my program? How can I work around this?

I guess I'll poke around the ghc internals a bit and see what's cooking.

	Thanks, Joel


More information about the Haskell-Cafe mailing list