Re: need a good idea for catch files deleted
- From: elgiei <liuggio@xxxxxxxxx>
- Date: 12 May 2007 15:24:53 -0700
first of all thanks for your attention,
my server already works with
pthread, socket, signal for timer
and many feature offered by includes,
for external call i mean for example all the "exec" 's
family,whithin you can use any binary file on your /bin directory
(or .exe file).
my ntree has
a lot of node, the same number of files and directories.
a node is composed by n pointer one for each son
so if my hard disk is composed only by :
/home/elgiei
/home/elgiei/file2.jpg
/home/elgiei/Desktop
/home/elgiei/Desktop/file1.jpg
my ntree is :
------/home/elgiei------------------------
--------- /--------\---------------------------
file2.jpg--------/home/elgiei/Desktop
-----------------------|-----------------------
------------------file1.jpg-------------------
(remove "-" with space)
after 60secs i rebuild a new ntree and i do a diff (ntreeNEW,ntreeOLD)
and i check the differences..
but it's not a smart solution for large data.
is there a signal Handler for catch file removed ?
anyone has a better idea????
i repeat the problem
i have to implement a server,that every n-seconds (eg. 10sec) sends to
other clients,which files and directory has been deleted or
modified in the system (not by my server)
the problem is catching the deleted or modified files,whitout an
expensive ntree snapshot.
a solution:
i can read all Hard disk and i can understand which files was created
or modified in the last 60-sec,
but i don't know about the deleted files.
thanks a lot
elgiei
On May 12, 8:29 pm, rober...@xxxxxxxxxxxxxxxxxx (Walter Roberson)
wrote:
In article <1178991600.048490.304...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
elgiei <liug...@xxxxxxxxx> wrote:
Good morning at all,
i have to implement a server,that every n-seconds (eg. 10sec) sends to
other clients,which files and directory has been deleted or modified.
i build a n-tree, for each files on harddisk there's a node into n-
tree,
this solution is not good for large hard disk..
and i can't use inotify (it's forbidden),
and only c solutions are accepted
without third party software or external calls.
the Hard disk are both ext3 and NTFS.
anyone has a good idea for build an efficient server??
No solution is possible within the constraints imposed. You are only
permitted to use C (you indicate), without third party software or
external calls, but you need external calls for two or more aspects
of the requirements:
1) C does not provide any mechanism to delay any particular amount
of time. The closest you can come is to "busy-loop", doing some
unnecessary work and checking the clock time to determine if you've
waited long enough. Busy-loops are inherently inefficient.
Most OS's provide means to delay for approximate times, but using
such an OS facility would be using an external call, not permitted
by your specifications.
2) C does not provide any mechanism to examine directories; C doesn't
know *anything* about directories. Most OS's provide means to examine
directories, but using such an OS facility would be using an external
call, not permitted by your specifications.
3) Your specifications require that information be periodically "sent"
to other clients. C does not provide any mechanims to communicate with
clients, other than whatever can be accomplished with regular files.
It is possible to come up with a reasonable information dissemination
method based upon writing out information (pre-pended with the size of
the information) to a known file, but if you want to do a traditional
client/server architecture, you would have to use OS-specific facilities
which would require external calls, not permitted by your
specifications.
i build a n-tree, for each files on harddisk there's a node into n-
tree,
this solution is not good for large hard disk..
How are you constructing your n-trees? Are you doing prefix-sharing
so that if you have figure1.eps and figure17.eps, the "figure1" portion
only gets stored once?
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
.
- Follow-Ups:
- Re: need a good idea for catch files deleted
- From: CBFalconer
- Re: need a good idea for catch files deleted
- From: Walter Roberson
- Re: need a good idea for catch files deleted
- References:
- need a good idea for catch files deleted
- From: elgiei
- Re: need a good idea for catch files deleted
- From: Walter Roberson
- need a good idea for catch files deleted
- Prev by Date: Re: Program help
- Next by Date: Re: pointer of pointer
- Previous by thread: Re: need a good idea for catch files deleted
- Next by thread: Re: need a good idea for catch files deleted
- Index(es):
Relevant Pages
|