UNIX command to get inode's tid and pid


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers UNIX command to get inode's tid and pid
# 1  
Old 08-05-2010
UNIX command to get inode's tid and pid

Hi everyone,

I am new here in www.unix.com, i found this site because I am looking for an answer to this problem of mine.

I need to know a UNIX command to display an inode's thread id and process id.

Hope someone can help me on this.

Thanks Smilie
# 2  
Old 08-05-2010
Do you mean display the process that has a file (access file name by inode) open?
An inode all by itself is part of the file system and has no relation to a process except when something has the file open. You also have to know which filesystem you have the inode from. Inode numbers are not unique systemwide, they are only unique inside one filesystem

Assuming what I said, assume your inode is 42:
Code:
fname=$(find /path/to/filesystem -inum 42 -print \;)

You now have a filename. You can use lsof or fuser to see what process, if any, has the file open. The presence lsof and fuser depend on what flavor of unix you have.
# 3  
Old 08-05-2010
Continuing on. Once you know the PID attached to the inode you can use HP Glance Plus (chargeable package) to find out the Thread Id (TID).
# 4  
Old 08-05-2010
Quote:
Originally Posted by methyl
Continuing on. Once you know the PID attached to the inode you can use HP Glance Plus (chargeable package) to find out the Thread Id (TID).

How will I use HP Glance Plus to get the TID and where will I get one? Can I use this on UNIX?

Thanks

---------- Post updated at 07:10 AM ---------- Previous update was at 06:45 AM ----------

Quote:
Originally Posted by jim mcnamara
Do you mean display the process that has a file (access file name by inode) open?
An inode all by itself is part of the file system and has no relation to a process except when something has the file open. You also have to know which filesystem you have the inode from. Inode numbers are not unique systemwide, they are only unique inside one filesystem

Assuming what I said, assume your inode is 42:
Code:
fname=$(find /path/to/filesystem -inum 42 -print \;)

You now have a filename. You can use lsof or fuser to see what process, if any, has the file open. The presence lsof and fuser depend on what flavor of unix you have.
What I am doing was getting the thread id of an inode in which the inode points to a connection to the server. The code I am using to get the inode for the connection was:

Code:
netstat -aeent | grep [ip address]

Kindly advise on what to do to get the thread id, I already searched on google but can't find anything. Thanks you for the help.

Last edited by rodkun; 08-05-2010 at 07:55 PM..
# 5  
Old 08-05-2010
Quote:
netstat -aeent
These command options are invalid on HP-UX . Am I mistaken in assuming that you have HP-UX?


Please define what you think an "inode" is ?


If you are not running HP-UX , what Operating System do you have?
# 6  
Old 08-05-2010
Quote:
Originally Posted by methyl
These command options are invalid on HP-UX . Am I mistaken in assuming that you have HP-UX?


Please define what you think an "inode" is ?


If you are not running HP-UX , what Operating System do you have?
I said UNIX in my first posts but its actually Linux 2.4.21, sorry for the confusion. I checked it using 'uname -a'.
# 7  
Old 08-06-2010
Quote:
but its actually Linux 2.4.21
That is quite an old version of the Linux kernel. What exactly do you plan to use the TID for once you identify it?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find the corresponding command for a existing PID?

Hi All, A process completed already and I have the PID. I want to know the which command used for this PID. 'ps' command and '/proc' folder having the list current process only. Is there a way to search completed process PID? Thanks, Manimuthu (5 Replies)
Discussion started by: k_manimuthu
5 Replies

2. Linux

nid missing from stacktrace and tid is decimal

To identify which java thread was hogging the cpu on linux I used to have to convert the lightweight thread id from a ps command (ps -eLo pid,ppid,tid,pcpu,comm | grep <PID>) to a hex value, take a thread dump and find the nid with the same hex value. I tried that recently on Enterprise Linux... (0 Replies)
Discussion started by: charriso
0 Replies

3. Shell Programming and Scripting

How can I get only FileName associated with a INODE on Unix much faster?

How can I get only FileName associated with a INODE on Unix in seconds instead of minutes, as it is the case for me as shown below. # Say I have FileDescriptor: 43, INODE: 2590784, File: abc.rdb. I want to get only filename associated with inode:2590784 and FD:43. $> time find / -inum... (7 Replies)
Discussion started by: kchinnam
7 Replies

4. Shell Programming and Scripting

Get Pid from a command output

pariosd -status NodeName ID ROLE STATE PROTECTION --------------------------------------------------------------------------- tn320_scm10 10 ACTIVE UP No Protection tn320_scm11 11 UNKNOWN UNKNOWN LocalApps ... (5 Replies)
Discussion started by: hariprasad123
5 Replies

5. Programming

getting the pid of another C program with unix calls

I have a C program called server.c which is supposed to get the pid of another program, client.c, and send a signal to it, but I'm not sure how to do it. Server.c is first run in the background then client is run in the foreground. I tried pid_t pid; pid = system("pidof -s client.c");... (3 Replies)
Discussion started by: busdude
3 Replies

6. Solaris

How to get the filepath and filenames in pfiles PID command?

Hi, When I use pfiles PID, it displays the below output and i just see the inode, can i able to get the full path and file name? pl help me on this. Current rlimit: 8192 file descriptors 0: S_IFCHR mode:0620 dev:308,0 ino:12582968 uid:1001378434 gid:7 rdev:24,26 O_RDWR ... (3 Replies)
Discussion started by: balamv
3 Replies

7. UNIX for Advanced & Expert Users

Retrieving command line arguments of a particular PID

hi The "ps" command shows the command line arguments of running processes: $ /bin/ps -o pid,args -e .... 26031 pico /tmp/crontab2KaG1Y 596 /usr/lib/sendmail -bd -q15m 9955 xterm -n 1 -sb -sl 800 -g 80+70+70 2627 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd -a 1691 .... I... (2 Replies)
Discussion started by: Andrewkl
2 Replies

8. UNIX for Dummies Questions & Answers

SCO Unix inode structure.

I have read quite a few threads here about the unix file creation date. I was interested in finding how to display it using a unix command. find did not help me so i looked at man inode. I found direction to htino.h which is described as the structure of the inode for S51K (UNIX), HTFS, EAFS... (4 Replies)
Discussion started by: rbn
4 Replies

9. UNIX for Dummies Questions & Answers

Session PID & socket connection pid

1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection? 2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies
Login or Register to Ask a Question