On Wed, Jul 16, 2008 at 10:12 AM, Knowledge Seeker
<[EMAIL PROTECTED]> wrote:

> First of all its no homework, I am a professional of window's world
> struggling in linux. I could have easily done it using win32 apis and
> have not come over here for help.
> And you are still not getting the problem I have asked for :), Brett
> understood it and suggested me to 'man' for fstat.
>
>
> Brett....
> I have seen the data structure returned by fstat but I have to think on
> the patterns of changes reflected in
>
> st_atimespec
> st_mtimespec
> st_ctimespec
> or even
> st_size
>
> but I was thinking on some other manner that could simply tell me that a file 
> has been copied
>
> Currently I am going through http://man.he.net/man2/fcntl
> over there I have found something called
>
> File and directory change notification (dnotify)
>       F_NOTIFY
>              (Linux  2.4  onwards)  Provide  notification  when the directory
>              referred to by fd or any  of  the  files  that  it  contains  is
>              changed.   The events to be notified are specified in arg, which
>              is a bit mask specified by ORing together zero or  more  of  the
>              following bits:
>
>
>  DN_CREATE   A file was created (open, creat, mknod,
>                          mkdir, link, symlink, rename)

I think a combination of seeing if the stats for the directory changed
plus Paul's suggestion of cycling through the directory (using
opendir/readdir) if a change occurred is the most portable solution. I
recommend going with the portable solution than using kernel-level
stuff -- the latter is total overkill for this kind of thing. POSIX
was developed to avoid using OS-specific system calls.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
 If I were to divulge it, it would overturn the world."
 -- Jelaleddin Rumi

Reply via email to