[GRASS5] R_open_driver() after fork()

Radim Blazek blazek at itc.it
Thu Feb 13 13:05:56 EST 2003

On Thursday 13 February 2003 06:25 pm, Glynn Clements wrote:
> With the patch, R_open_driver() shouldn't hang indefinitely in
> sync_driver(); you should get a warning after 5 seconds then failure
> after a further 10 seconds (15 seconds total). Basically, the second
> R_open_driver() call should eventually fail, rather than blocking
> indefinitely.
> If SIGALRM fails to interrupt the read() call even with the patch,
> then your OS kernel is broken.

Yes, I have got:
Warning - no response from graphics monitor <x0>.
Check to see if the mouse is still active.
ERROR - no response from graphics monitor <x0>.
Monitor <x0>: Caught SIGPIPE

> Presumably the child calls one of the exec*() functions shortly after
> the fork()? 


> In which case, we should probably set the close-on-exec
> flag on monitor connections:
> 	flags = fcntl(_wfd, F_GETFD);
> 	flags |= FD_CLOEXEC;
> 	fcntl(_wfd, F_SETFD, flags);
> This will force the descriptor to be closed automatically upon
> exec*().

OK. Could you do that as xdriver expert?

> More generally, fork() and high-level APIs don't mix.

Yes, I see, it is old story - better framework for GUI.

Thank you a lot.

More information about the grass-dev mailing list