LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-04-2008, 08:27 PM   #1
Ook
Member
 
Registered: Apr 2004
Location: Hell, Arizona
Distribution: Slackware 14.1
Posts: 492

Rep: Reputation: 81
How to capture output of system call that uses printk?


I have a simple system call that uses printk to output some text. I have a small c program that calls the system call. This works, and the desired text is output to the console. How can I capture this text? If I call my program with >somefile.txt, somefile.txt is blank. If I use script, I see the line that calls the c program, but the output from the system call does not appear. If I use script -c <myprogram>, same thing. I'm using a virtual machine via VMware, so I can't even capture the screen because AFAICT, VMware only captures .bmp files. So, how can I capture the output of a system call that uses printk?

Debian 2.6.23.17 kernel.

Edit: FWIW, I was able to:

dmesg | tail > output.txt

to get the text I wanted. So I did what I needed to do - but why can't the output from printk be captured using script or > ?

Last edited by Ook; 04-04-2008 at 08:48 PM.
 
Old 04-23-2008, 11:22 PM   #2
aus9
LQ Guru
 
Registered: Oct 2003
Distribution: Fedora 25 Gnome (Wayland)
Posts: 5,132

Rep: Reputation: Disabled
I am glad you solved it.

by any chance have you tried virtualbox vs vmware?

2) I am no expert but I assume you have read the kernel dox on kernel hacking?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get stderr output when using a ::system() call tmc3011 Programming 2 01-25-2008 04:17 AM
Is printk a system call? gky Linux - Software 2 12-31-2007 05:26 AM
Can't get printk output directed to console xuanadoo Linux - Newbie 0 11-07-2006 08:40 PM
perl: send output of system() call to variable drkstr Programming 4 07-23-2006 10:47 PM
output of printk can NOT be found in /var/log/messages linshu Linux - Software 1 02-13-2004 09:06 AM


All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration