ych@maps.cs.cmu.edu (Yuan Hsieh) (12/02/89)
A questions on Sunview programming concerning use of window_read_event(). I have the following event handler for a canvas window: canvas_handle_event(canvas,event,arg) { ... switch(event_acton(event)) { ... case 'Z': z_proc(canvas); break; ... } ... } When event 'Z' occurs, z_proc() is called and is defined as follows: [z_proc() is suppose to wait for a 'down' event to occur.] z_proc(canvas) { ... while(1) { if ((winderr = window_read_event(canvas,event)) == 0) { if (event_is_down(event)) break; } else if (winderr == -1) { printf("errno:%d\n",errno); } } ... } Problem: if 'Z' event is the first thing I do, z_proc() executes with no fault. But if there are any other event before 'Z', window_read_event() returns -1 with errno of 14 which is, (according to man 2 intro): 14 EFAULT Bad address The system encountered a hardware fault in attempting to access the arguments of a system call. I am pretty sure all other parts of my program does not affect this at all. Anyone know what this means? Am I missing something? Please reply to ych@maps.cs.cmu.edu.. Thanks.