From: Martin Stromberg Message-Id: <199803181256.NAA19087@propus.lu.erisoft.se> Subject: Re: Where to get the latest sources for djtar To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) Date: Wed, 18 Mar 1998 13:56:39 +0100 (MET) Cc: djgpp-workers AT delorie DOT com In-Reply-To: from "Eli Zaretskii" at Mar 17, 98 06:39:27 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk > > 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