Sunview Programing Question/Problem

Yuan Hsieh ych at maps.cs.cmu.edu
Sat Dec 2 06:33:00 AEST 1989


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 at maps.cs.cmu.edu.. Thanks.



More information about the Comp.sys.sun mailing list