[GRASS5] Volunteer wanted for CELL driver color problem

Eric G. Miller egm2 at jps.net
Wed Apr 18 21:09:27 EDT 2001


On Wed, Apr 18, 2001 at 10:34:30PM +0100, Glynn Clements wrote:
> 
> Andreas Lange wrote:
> 
> > i watched this strange behaviour with my last cygwin/Windows build of
> > the pre-stable code. IMHO it is not the "start" parameter, but d.mon
> > start=CELL works once, but no longer after the CELL driver is stopped
> > with d.mon stop=CELL. 
> > I can restart the CELL driver only if i remove the
> > $LOCATION/.tmp/$hostname/CELL socket file. I think for some reason the
> > file/socket is not removed. 
> 
> Compare the code in src/display/devices/lib/SWITCHER.c:
> 
>     if (G_sock_exists(sockpath) && 
> 	(listenfd = G_sock_connect(sockpath)) != -1)
>     {
> 	close (listenfd);
> 	G_fatal_error ("Monitor <%s> is already running", me);
>     }
> 
> to that in src/display/devices/XDRIVER/XDRIVER24/SWITCHER.c:
> 
>     if (G_sock_exists(sockpath))
>     {
>         if ((listenfd = G_sock_connect(sockpath)) != -1)
>         {
> 	    close (listenfd);
> 	    fprintf (stderr, "Monitor <%s> is already running\n", me);
>             exit (EXIT_FAILURE);
>         }
>         if (unlink (sockpath) != 0)
>         {
>             fprintf (stderr, "Failed to remove stale socket file:\n"\
>                     "\t%s\n", sockpath);
>             exit (EXIT_FAILURE);
>         }
>     }
> 
> Someone thought to remove the socket if it exists but is unused; but
> only for the XDRIVER case.

Doh! I must have forgot to update the generic driver after I updated the
XDRIVER version.  Originally, the library code removed the socket
file, but I changed it to force the server to handle it.  Only way I'm
aware of to see if a socket file is in use is to try to connect to it.
You can't just blindly remove it, because the OS will let you even if a
server is running and is listening on it.

> I've been looking through some of the files in src/display/devices
> today, and it's clear that the whole thing needs a spring clean. A lot
> of code is (more or less) duplicated when it ought to be shared, and
> changes only seem to get put into one or other of the different
> versions.

Yes, the SWITCHER.c in the XDRIVER had been hacked upon in a
non-compatible way with the generic SWITCHER.c.  Would be better to have
common code stay common though...

-- 
Eric G. Miller <egm2 at jps.net>

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list