Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to find pipe name associated with a file descriptor

Posted on 2011-09-23
6
Medium Priority
?
414 Views
Last Modified: 2012-08-13
I use lsof, and one of the output is:
useA      10434  xsm111p1   13r     FIFO                0,6           56442761 pipe

the 13r I think it is file descriptor number that is associated with the pipe. how can I find the "file" that is associated with 13?
0
Comment
Question by:ndoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 1600 total points
ID: 36594192
Pipes don't have names (except named pipes). Regular pipes are just in-memory connections.
lsof does list the names of named pipes (they have a different major/minor device number as well)
0
 
LVL 21

Assisted Solution

by:Papertrip
Papertrip earned 400 total points
ID: 36594219
@duncan -- the lsof output says FIFO so it is a named pipe.

I tried to answer this question and couldn't get further than 'ls -l /proc/10434/fd'

That kinda works but if there are multiple named pipes then I couldn't figure out how to distinguish between them.  Any ideas?

BTW -- ndoung -- try that ls command I just wrote, it will kinda do what you want, not sure of your exact needs though so it might not.
0
 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 1600 total points
ID: 36594335
@Papertrip No you are wrong. It says FIFO for all pipes, named or otherwise. I tried a named pipe, and the name was shown by lsof. Named pipe example follows, 3 screens
14:40:25$ mkfifo t5
14:40:48$ cat t5

Open in new window

Screen 1. create and read from named pipe
14:39:41$ cat >t5

Open in new window

Screen 2. write to named pipe
10:38:15$ lsof|grep -w t5
cat       4800       dunc    3r     FIFO        8,2      0t0   16237716 /home/dunc/tests/t5
cat       4801       dunc    1w     FIFO        8,2      0t0   16237716 /home/dunc/tests/t5

Open in new window

Screen 3. lsof output for named pipe
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 1600 total points
ID: 36594352
Anonymous (regular) pipe example, 2 screens
14:48:19$ cat|cat

Open in new window

Screen 1. connect 2 processes with regular pipe
14:48:19$ lsof|grep cat|grep FIFO
cat       4829       dunc    1w     FIFO        0,7      0t0      28608 pipe
cat       4830       dunc    0r     FIFO        0,7      0t0      28608 pipe

Open in new window

Screen 2. lsof output for regular pipe
Both kinds of pipe exist in the underlying flat file system, in that they have an inode number. But a named pipe has a user directory entry while a regular pipe does not. I guess you could differentiate regular pipes by their inode numbers, that would be about the limit of what you could do.
0
 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 1600 total points
ID: 36595031
@ndoung - you are correct. 13r means file unit 13 open for reading - meant to post that originally
0
 

Author Comment

by:ndoung
ID: 36596530
I cd to /proc/<pid>/fd, and see file description 13 as below.
lr-x------ 1 xsm111p1 bband 64 Sep 25 18:29 13 -> pipe:[57921995]
So the pipe is regular and not named pipe. named pipe can have real file assocaited with it as /home/dunc/tests/t5.

duncan, papertrip, Thank you all  very much.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question