From: Steven Smith <sos22@cam.ac.uk>
To: Mohammed Khalid Ansari <khalid@ncst.ernet.in>
Cc: linux c programming mailing list <linux-c-programming@vger.kernel.org>
Subject: Re: how to read a constantly changing file
Date: Tue, 4 Jun 2002 10:54:56 +0100 [thread overview]
Message-ID: <20020604095456.GA1012@cam.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.33.0206041504580.32292-100000@soochak.ncst.ernet.in>
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
> I want to know how can I read a file (through a C code) which is
> constatnly changing, like a log file.(eg tail command)
As far as I can make out, tail does it by sitting in a loop
and calling sleep(1), and then fstat() to see if the file's grown.
You might be better off looking at directory change notifications
for the parent directory. The closest thing this has to documentation
is fs/dnotify.c in the kernel source, though.
Steven Smith,
sos22@cam.ac.uk.
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2002-06-04 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-04 9:36 how to read a constantly changing file Mohammed Khalid Ansari
2002-06-04 9:54 ` Steven Smith [this message]
2002-06-05 11:39 ` Mohammed Khalid Ansari
2002-06-05 16:12 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020604095456.GA1012@cam.ac.uk \
--to=sos22@cam.ac.uk \
--cc=khalid@ncst.ernet.in \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).