Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Aincluberstatio. ho tincluabectedilo, is tinclude esys / stat . hs todefine WFIE 1 0 wotd cap ( const char * , the _ t )

Aincluberstatio. ho
tincluabectedilo, is
tinclude esys/stat. hs
todefine WFIE 10
wotd cap(const char *, the_t);
struct stat sb;
Int aein(Int arge, char *arge)
(1)
Int J
tine_t lest_tine[ GIFTLE+1];
if (?bar(args)bar(2))(
it(1);
if (--ares > MrTif )
wit(1);
J
frtnitislirat im
for(j =1, jse seret; jes)
if (+1=1(-sov(j),san)=-1)
t
xit(1);
]
inst_t ine(j)=*h.at_nt ins;
for (j;)
t
for(j-1; is argt; j*)
, int_tiar(j));
,sen(69) :
}
j
woid tow (const thar *nene, tine_t last)
(.)
foss long ss statics sbout the file cas be resi check the wolification tive of
t.
fprintf(stderr, "lookout: 'ks changedly", nane);
exit(6);
j
Modify the template program, "lookout. 5" on p.56-57 with the following additional capabilities
a. Repeat the following steps 5 times (this means, after 5 seconds of running, your program
should terminate without printing anything if there is no change detected.)
i. Wait 1 seconds using "sleep(1)" call
ii. Call "stat" system call to extract the file attributes against given files in command
line arguments (the lookout, c program in p.56 may accept up to 10 files). Your
program should be able to accept up to 10 filles for monitoring.
iii. You program should check any changes in any of the following attributes:
stmode
stuoliok
st size
st.atime
st motime
iv. When your program detects any changes, your program should immediately print
out number codes given below and EXIT!
Change of st_mode - print 1
Change of st_nlink- print 2
Change of st_size-print 3
Change of st_atime - print 4
Change of st_mtime - print 5
Once printing is done, your program should terminate. Make sure your
condition checking and printing should be done in the above order! Make
sure you print number codes in one line (without any newline character)!
Example output when you change the file contents (9.5, using vi): 345
If your program prints more than one number code, then place spaces in
between.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago