how do you watch for an incoming file

Chris Torek chris at mimsy.umd.edu
Thu Nov 30 08:50:10 AEST 1989


In article <1989Nov29.042955.8217 at virtech.uucp> cpcahil at virtech.uucp
(Conor P. Cahill) writes:
>	forever loop
		...
>		stat(dir,to get current dir mtime var)

If you open the directory, and use fstat on the resulting descriptor,
you will accumulate less system time.  Unfortunately, it seems that some
Unix systems refuse to let you open a directory these days, so you
would need something like

	fd = open(dir, 0);
	forever loop ...
		result = fd >= 0 ? fstat(fd, &st) : stat(dir, &st);
		if (result < 0)
			er ror er ror ster ril lize

(no points for remembering the source of the `er ror' line :-) )
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list