Mail Archives: djgpp-workers/1998/03/18/07:59:12
> > If there aren't any then I can't see how else to know that the disk is
> > full, except calling statfs.
>
> I think that since this is expensive and since djtar will cope with this
> (after the patch I suggested), we can live with this limitation of
> `mkdir'. In other words, let the applications which need to handle this
> call `statfs' if they want.
Well, your patch stops the crashing.
Two things to note: if it can't create the directory, it just asks the
user again and again. Secondly, it stopped the skipping functionality.
When the user gives up, because he can't create the directory and gives
an empty string as reply, djtar still tries to create the directory when
the next file in the archive is the_directory_that_can_be_created/file.
Back to the improvement of mkdir's settting of errno.
Well, I'm not sure it is that expensive. You see statfs() does a
INT21/some_numbers. In my mesaurements, statfs() is less expensive than
access(), which is already there in case of errors.
And again this is when something goes wrong, a healthy program
should act to the information it gets, and realize that it's just to
give up (in case of ENOSPC) or give up on this directory (in case of
ENAMETOOLONG).
This is what I used to measure (from memory):
[some includes]
int main(void)
{
[some vars]
t1 = time();
for(i = 0; i < 100000; i++)
{
ret = statfs("c:", more_args);
ret = statfs("d:", more_args);
/* or
ret = access("c:/", D_OK);
ret = access("d:/", D_OK);
for access measurements.
*/
}
t2 = time();
printf("errno = %d, ret = %d, t1 = %ld, t2 = %ld; t2-t1 = %ld.\n",
errno, ret, t1, t2, t2-t1);
return(0);
}
/*
compile with "gcc -O2 -g *.c -o t"
*/
MartinS
- Raw text -