Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use pseudo terminals as named pipes in Finder UNIX
I am currently using VLC for my streaming radio fix. As VLC does not update its track and title information, the are three ways for me to check the current streaming radio track. The first two are to Get info on the current stream in VLC, or use VLC's embedded message viewer, both of which require a lot of mousing around, aren't a quick view solution, and neither allow me to constantly see the changing track names.

The other is to write the message viewer's contents to a log. I was using a standard log file, but after constantly having to erase the file after it became too big, I realized that this going to kill the hard drive in no time, especially if I do the same thing on a flash-drive-based linux distro (Which I am planning).

After digging, I found out about FIFOs and named pipes, even seeing a hint here about them. I also read about how the GUI side of OS X does not handle named pipes graciously (Finder or VLC crashes). But reading around, I noticed pseudo terminals and had an epiphany. GUI apps can access /dev devices (such as sound cards and serial ports) by name, so why can't they write to them?

I end up assigning VLC to log to /dev/ttyu1 then I cat /dev/ptyu1. tail does not work on /dev/ptyu1 because the pseudo-terminal does not have an for it to work from, and cat keeps reading until it receives one (when VLC quits). This way, VLC in the GUI thinks I am logging to a file, and I can see what is being logged (via Terminal) without actually writing the log to the hard drive.

Another use is to log to a file and let Geek Tool display the info, without having to actually write the file. This works as a named pipe, using the following:

Write to /dev/ttyxn where x is a letter between p and w, and n is a number from 0 to 9 and a to f (hex 0-15). Read from /dev/ptyxn, where x and n are the same as they were before.

There are two problems with this solution. First, only one program can read from /dev/ptyu1 at a time. Not too big of a problem. I don't think multi-app access to a file is needed much. On the other hand, more then one program can write to /dev/ttyu1 at a time. You have just created a very minimal version of Logger/Syslog :D

The second problem is not with this usage, but with trying to pipe the output from /dev/ptyu1 to grep, then pipe it out to another program. It seems grep needs an before its output can be sent to another program, which can't be done with this method (or with using tail -f something | grep something | another program).
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)

Use pseudo terminals as named pipes in Finder | 2 comments | Create New Account
Click here to return to the 'Use pseudo terminals as named pipes in Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use pseudo terminals as named pipes in Finder
Authored by: osxpounder on Jan 08, '08 10:52:22PM

I'm curious: what is VLC doing for you?

I've listened to radio streams in programs that are meant for it, like iTunes or RealPlayer [back in my grungy Windows days] or WinAmp, but I never looked into VLC for that, or found out why people want to use it for that.

I got the impression, from something I read once, that VLC could be used to pipe a stream from one of my computers out onto my local network, so that I could gain access to the same stream there. Does that sound right? Possible? If so, does anyone have a link that explains how to do it?

[ Reply to This | # ]
Use pseudo terminals as named pipes in Finder
Authored by: jdv on Jan 10, '08 03:07:13PM

You might be able to figure it out by simply running the "Streaming/Export Wizard" from VLC's archive menu...

[ Reply to This | # ]