* How to create a fixed length character/block device/file ?
@ 2007-01-26 20:10 Khai Doan
2007-01-26 20:49 ` H. Peter Anvin
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Khai Doan @ 2007-01-26 20:10 UTC (permalink / raw)
To: linux-kernel
Sorry if this is the wrong list. I've search google, but have not found
solution to my problem.
I have a long running application which split out lots of debugging
information. I can't redirect the output to a regular file because that
file would grow and eat up all the diskspace. I can't redirect to
/dev/null. What I want is the last 1MB of the output before my
application terminated. So I need to create a special file / device on
the system. Please tell me if there is an existing device that I can
use, or point me in the right direction so that I can role my own device.
Thanks
Khai Doan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create a fixed length character/block device/file ?
2007-01-26 20:10 How to create a fixed length character/block device/file ? Khai Doan
@ 2007-01-26 20:49 ` H. Peter Anvin
2007-01-26 20:50 ` H. Peter Anvin
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2007-01-26 20:49 UTC (permalink / raw)
To: Khai Doan; +Cc: linux-kernel
Khai Doan wrote:
> Sorry if this is the wrong list. I've search google, but have not found
> solution to my problem.
>
> I have a long running application which split out lots of debugging
> information. I can't redirect the output to a regular file because that
> file would grow and eat up all the diskspace. I can't redirect to
> /dev/null. What I want is the last 1MB of the output before my
> application terminated. So I need to create a special file / device on
> the system. Please tell me if there is an existing device that I can
> use, or point me in the right direction so that I can role my own device.
>
Create a FIFO (see "man mkfifo"), and write a program that reads the
FIFO and retains the information you're interested in.
-hpa
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create a fixed length character/block device/file ?
2007-01-26 20:10 How to create a fixed length character/block device/file ? Khai Doan
2007-01-26 20:49 ` H. Peter Anvin
@ 2007-01-26 20:50 ` H. Peter Anvin
2007-01-26 20:50 ` Phillip Susi
2007-01-26 21:35 ` Alan
3 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2007-01-26 20:50 UTC (permalink / raw)
To: Khai Doan; +Cc: linux-kernel
Come to think of it, you can just use "tail" as the application that
reads the FIFO.
-hpa
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create a fixed length character/block device/file ?
2007-01-26 20:10 How to create a fixed length character/block device/file ? Khai Doan
2007-01-26 20:49 ` H. Peter Anvin
2007-01-26 20:50 ` H. Peter Anvin
@ 2007-01-26 20:50 ` Phillip Susi
2007-01-26 21:04 ` Jiri Slaby
2007-01-26 21:35 ` Alan
3 siblings, 1 reply; 6+ messages in thread
From: Phillip Susi @ 2007-01-26 20:50 UTC (permalink / raw)
To: Khai Doan; +Cc: linux-kernel
Khai Doan wrote:
> Sorry if this is the wrong list. I've search google, but have not found
> solution to my problem.
>
> I have a long running application which split out lots of debugging
> information. I can't redirect the output to a regular file because that
> file would grow and eat up all the diskspace. I can't redirect to
> /dev/null. What I want is the last 1MB of the output before my
> application terminated. So I need to create a special file / device on
> the system. Please tell me if there is an existing device that I can
> use, or point me in the right direction so that I can role my own device.
myapp | tail -c1048576 > logfile
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create a fixed length character/block device/file ?
2007-01-26 20:50 ` Phillip Susi
@ 2007-01-26 21:04 ` Jiri Slaby
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2007-01-26 21:04 UTC (permalink / raw)
To: Phillip Susi; +Cc: Khai Doan, linux-kernel
Phillip Susi napsal(a):
> Khai Doan wrote:
>> Sorry if this is the wrong list. I've search google, but have not
>> found solution to my problem.
>>
>> I have a long running application which split out lots of debugging
>> information. I can't redirect the output to a regular file because
>> that file would grow and eat up all the diskspace. I can't redirect
>> to /dev/null. What I want is the last 1MB of the output before my
>> application terminated. So I need to create a special file / device
>> on the system. Please tell me if there is an existing device that I
>> can use, or point me in the right direction so that I can role my own
>> device.
>
> myapp | tail -c1048576 > logfile
AFAIK this will output the file after the app termination. He wants to know the
log before that.
Just write your own reader which will output last meg in some intervals...
regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create a fixed length character/block device/file ?
2007-01-26 20:10 How to create a fixed length character/block device/file ? Khai Doan
` (2 preceding siblings ...)
2007-01-26 20:50 ` Phillip Susi
@ 2007-01-26 21:35 ` Alan
3 siblings, 0 replies; 6+ messages in thread
From: Alan @ 2007-01-26 21:35 UTC (permalink / raw)
To: Khai Doan; +Cc: linux-kernel
On Fri, 26 Jan 2007 12:10:00 -0800
Khai Doan <khai@genius.com> wrote:
> Sorry if this is the wrong list. I've search google, but have not found
> solution to my problem.
>
> I have a long running application which split out lots of debugging
> information. I can't redirect the output to a regular file because that
> file would grow and eat up all the diskspace. I can't redirect to
> /dev/null. What I want is the last 1MB of the output before my
> application terminated.
Just pipe the output into a program or perl script which does this. You
don't need a device file.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-01-26 21:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26 20:10 How to create a fixed length character/block device/file ? Khai Doan
2007-01-26 20:49 ` H. Peter Anvin
2007-01-26 20:50 ` H. Peter Anvin
2007-01-26 20:50 ` Phillip Susi
2007-01-26 21:04 ` Jiri Slaby
2007-01-26 21:35 ` Alan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox