Too many raster files open
Michael Hanratty
hanra001 at gold.tc.umn.edu
Wed Jun 18 17:11:04 EDT 1997
I have figured out the problem:
In message <9706130905.ZM27213 at impact1.hpcc.nectec.or.th> writes:
> Bill and Michael,
>
> On Jun 12, 2:50pm, William L. Baker wrote:
> > No one had a remedy, but someone did point out where the
> > message comes from, but now when I look I see that I've lost that
> > information.
>
> I have a copy of the reply to Bill's posting from Dec 19, 1996 I include the
> entire message below.
<snip> >
> > There are two aspects to this problem (I think). The first is
> > the origin of the warning. This warning is produced in
> > file src/libes/gis/opencell.c if you try to open more than
> > MAXFILES files. MAXFILES is a constant that is #defined to be
> > 30 in src/libes/gis/G.h
> >
> > I don't know why it's 30, probably the programmers thought that
> > nobody in their right mind would need more than 30 open files
> > anyawy (sounds vaguely familiar...).
> > So I guess you could change this constant and recompile GRASS
> > (you'd probably need to recompile or at least relink just about
> > all of GRASS since this is a fairly central point).
> >
The problem is that the MAXFILES is compared to the file pointer, fd, which is
never decremented. Each new file opened is added as the next higher file. So,
it doesn't matter how often you close files, if you open more than MAXFILES
during a program run, then the program will abort. The best fix would be to
have a static variable that is shared by the opencell and closecell programs
that is incremented and decremented when a file is opened and closed,
respectively. Then MAXFILES would be compared to the actual number of files
open, instead of the number of files that have been opened since the program was
started.
Has anyone done this fix?
Michael Hanratty Phone: (612) 627-4590
St. Anthony Falls Laboratory Fax: (612) 627-4609
Dept. of Civil Engineering
University of Minnesota
Mississippi River @ 3rd Ave. SE
Minneapolis, MN 55414
More information about the grass-user
mailing list