tail -f

James da Silva jds at mimsy.UUCP
Thu Dec 8 02:33:34 AEST 1988


In article <412 at fedeva.UUCP> jbr0871 at fedeva.UUCP (Blaine Robertson) writes:
>Can someone please tell me how 'tail -f' works?.  Obviously, it does not
>do a busy loop while doing a stat on the file.  I know that it has got
>to be blocked, waiting for the length to change, but how does it get
>notified of a change?  Thanks in advance for any responses.

Actually, tail doesn't get notified of a change.  It simply sleeps for a
second, then tries a read().  Probably something like this:

	while(1) {
		sleep(1);
		while(size=read(file,buffer,BSIZE))
			write(1,buffer,size);
	}

Nothing fancy, I'm afraid.

Jaime
...........................................................................
: domain: jds at mimsy.umd.edu				     James da Silva
: path:   uunet!mimsy!jds



More information about the Comp.unix.questions mailing list