This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem Opening a FILE


On Mon, 2008-07-07 at 10:57 -0700, Goel, Khushboo wrote:
> I am a intern at Intel Corporation, looking for some help in system Tap,
> new with technology. 
> I am using System Tap for probing kernel function so that I can know
> more about packet that are send over network. For this I need to open a
> File so that I can save all raw data as I probe in the kernel (that's
> why can't use -O FILE option). I want to save this data when I am
> probing in the function, continuously.

I guess we'd need to know more about why stap -o FILE doesn't work for
you.  Have you considered using
	stap .... > FILE
or
	stap ... | myprog > FILE
where myprog is some program that reads and filters stap output?

stap stdout really is the intended channel for data from printf() and
similar functions in stap scripts.  As far as I know, stap doesn't
provide anything like fprintf() to write to an alternate channel.

Note that unlike libc printf(), stap's printf() can write binary data
(using %b) if that's your desire.  Also, stap's mechanism for
transferring data from kernel to user mode has a very high bandwidth, in
case that's a concern.

>  
> 
> 
> So I am using embedded c code to open a file, but some how its not
> allowing me. Can anyone tell how to open a file in System tap, and which
> files tot include.

Embedded C in stap scripts is pulled as-is into the kernel module that
stap creates and inserts.  So unless you're trying to write kernel code
to simulate libc opens and writes (which seems to me an ambitious and
dangerous undertaking), embedded C is probably not your answer.
> 
>  
> 
> I using FILE *fp = NULL, to make file pointer, but its not allowing to
> me do it.

FILE is a libc (user-mode-side) construct, not available to stap
scripts.

> 
> Or any other alternative way to save all the data.
> 
>  
> 
> Please, I am new to System tap.

I hope this helps.

> 
> 
> Regards
> Khushboo Goel

Jim Keniston


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]