AKB Forums

Go Back   AKB Forums > Technical sections > Software Security
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Software Security Discussing software security algorithms, tricks, vulnerabilities

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Nov 29, 2004, 12:15   #1
4294967296
 
Boyov's Avatar
 
Join Date: Mar 2002
Location: /proc/1
Posts: 378
Rep Power: 7
Reputation: 10
Monitoring fopen()/fprintf()

Question to GURUs :

How to monitor fopen()/fprintf().

OS - RedHat 7.3 (2.4.20-18.7.cern)

Give some hints, please.


P.S. I am already looking through coreutils sources (to find out how 'tail -f' is implemented).
__________________
Free your mind and your OS will follow
Boyov is offline   Reply With Quote Quote selected
Old Nov 29, 2004, 12:23   #2
Главный Лысый
 
Pascal's Avatar
 
Join Date: Oct 2001
Location: AM
Posts: 2,829
Rep Power: 7
Reputation: 38
Send a message via ICQ to Pascal
lsof - pomozhet dlya fopen - a.
__________________
Ruben Muradyan
Technical Director
PanARMENIAN Network: Armenian News

----------------------------------------------------
Лысина - это полянка, вытоптанная мыслями.
----------------------------------------------------
Pascal is offline   Reply With Quote Quote selected
Old Nov 29, 2004, 17:15   #3
Честный Кот
 
Reckon_'s Avatar
 
Join Date: Apr 2004
Location: Yerevan
Posts: 1,715
Rep Power: 5
Reputation: 86
В принципе можно даже использовать strace.

Беда лишь в том, что fopen/fprintf не являются непосредственно системными вызовами (fopen() вызывает в свою очередь open(), а fprintf() вызывает
write(), кажется).

Но, зная этот факт, можно сделать так:

strace -p <pid> -e trace=open,write

где <pid> - номер исследуемого процесса.


Quote:
P.S. I am already looking through coreutils sources (to find out how 'tail -f' is implemented).
Читаем мануал по tail:

.......................................

With --follow (-f), tail defaults to following the file descriptor,
which means that even if a tail'ed file is renamed, tail will continue
to track its end. This default behavior is not desirable when you
really want to track the actual name of the file, not the file descrip-
tor (e.g., log rotation). Use --follow=name in that case. That causes
tail to track the named file by reopening it periodically to see if it
has been removed and recreated by some other program.

.........................................

Короче говоря: tail использует механизм тайм-аутов, и проверяет статус файла через определенный период времени. Просто и эффективно. И tail не attach-ается к какому-либо процессу (как деляет strace), и не лезет в ядро. Так что перехватывать вызовы чтобы понять, как устроен tail - нет резона.
__________________
Честный Кот
------------------------------------------------------
Еще не жаль огня, и Бог хранит меня... (с) А. Макаревич

Когда я трезв, я - Муму и Герасим, мама;
А так я - Война и Мир. (c) БГ

Last edited by Reckon_ : Nov 29, 2004 at 17:49.
Reckon_ is offline   Reply With Quote Quote selected
Old Nov 30, 2004, 11:47   #4
4294967296
 
Boyov's Avatar
 
Join Date: Mar 2002
Location: /proc/1
Posts: 378
Rep Power: 7
Reputation: 10
2 Pascal: Spasibo


2 Reckon_: Tebe toje spasibo

Quote:
Originally Posted by Reckon_
Так что перехватывать вызовы чтобы понять, как устроен tail - нет резона.
Ya i ne sobiralsya perxvativat' vizov dlya togo chtobi ponyat' kak tail rabotatet. Mne isxodniki ego bili nujni dlya togo chtob ponyat' kak on sam rabotatet.
__________________
Free your mind and your OS will follow
Boyov is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitoring and Evaluation Coordinator - Civic Advocacy Support Program PsilocybeLarvae Jobs 0 Nov 10, 2004 11:12
Monitor / AAA NGOC PsilocybeLarvae Jobs 0 Jul 13, 2004 11:50
Development Program Specialist Gayka Jobs 0 Apr 29, 2003 09:03


All times are GMT. The time now is 10:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link