LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training 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 02-28-2003, 04:07 PM   #1
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Rep: Reputation: 30
FIFO question


I am running a dedicated Neverwinter Nights server running on my RH8.0 Linux box. If you run this service with the correct options you can type commands into the server to load modules and broadcast server messages and such. What I want to do (simply for learning's sake) is to have my backup script on my server tell the NWN process to broadcast a message warning of lag caused by the backup.

I asked on a NWN Server Admin forum how to go about this and I was told to look into FIFOs. I did some peeking around on what they are. I was unable to get a firm grasp on how to have a service read a FIFO. The only command that I've found that is related to this is mkfifo, which seems quite simple.

Could anyone walk me through making a service take it's input from a FIFO instead of from standard input, how to make a script write to a FIFO, and anything else that's relevant to the issue?
 
Old 03-01-2003, 12:39 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Official disclaimer: I have never used FIFOs, so please don't take what I suggest as gospel, truth, or anything remotely resembling an authoratative response.

I read the man page for mkfifo and it didn't say much other than "use this command to make a fifo"... duh. So I tried:
Code:
apropos FIFO
and got a listing of other commands. Most are C-oriented, but the one you might want to take a look at is:
Code:
man 4 fifo
It says FIFOs are pipes maintained by the kernel that have entries in the filesystem as a "reference point". That's what I love about linux: everything, EVERYTHING, is a file. That means you should be able to access the pipe just like you would access any regular file. Meaning, to write to the FIFO, you probably only have to issue a command like so:
Code:
echo "Server may experience lag from backup process" > /path/to/fifo
Reading from it should be fairly simple as well.

I don't know if it will be an issue for you, but you should have a process trying to read the FIFO before a different process writes to it. The kernel has nowhere to send the write data if nobody is ready to read it.

If this doesn't get you started, and nobody else jumps in, you may be better served asking a similar question in a programming forum. FIFOs are a classic programming language structure. You may get a lot of technical details and a lot of it will probably be geared toward implementing a FIFO in C, but you should be able to get what you need.
 
  


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
ST7554: fifo underrun! Spriggan Linux - Hardware 2 03-01-2005 05:02 AM
snmptrapd FIFO eccsamba Linux - Networking 2 11-24-2004 09:52 AM
FIFO using pointers AquamaN Programming 2 03-21-2004 06:51 PM
Non-blocking write to a fifo droussel Programming 0 05-22-2003 02:12 PM
nfs FIFO??? granny Linux - Newbie 1 12-16-2002 04:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 AM.

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