(First post)
Hi,
Doing an strace on tail -f <file> reveals that it does an fstat every
1 second (fstat, nanosleep 1, fstat nanosleep 1...) for the file size and
reads and writes to stdout whenever the value of st_size returned changes.
A better way of doing this IMHO would be for the logging process to write to
a pty master device and for the reading process to pick it up from the
slave. Tht way you can use async IO (SIGIO / sigaction(2)) or a blocking
POLL on the pts device.
Sapan
On Fri, Mar 29, 2002 at 07:06:44PM +0530, Manish K Arya wrote:
// Hi
// how can i read logs dynamically in C. like if i do tail -f <logfile> output goes
to stdout.i want same kind of mechenism to read log files in C.
//
// bye
// ---
// Manish Kumar Arya
//
//
//
// See Dave Matthews Band live or win a signed guitar
//
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp
//
// ================================================
// To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
// To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject
header
// Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
// =================================================
//
----- End forwarded message -----
================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
=================================================