LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-03-2011, 07:00 AM   #1
damade
LQ Newbie
 
Registered: Feb 2011
Distribution: Red hat, Solaris, AIX, HP-UX, FreeBSD
Posts: 15

Rep: Reputation: 2
How to know cmdline for a pid. (no ps, no top, no /proc)


Hi all !!!
A few days ago i had to deal with a very odd situation.
Ps hanged. Top hanged. i discovered a pid which seems to block the execution of this commands.
I needed to know which was the process behind that pid. But when trying to access /proc/$pid/ session hanged.

I suppose this problem to access /proc/$pid cause the hang of the other commands (ps,top, etc)

How can i know info about a pid if i can't access data on /proc ?

thanks
 
Old 02-03-2011, 06:41 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Userland processes depend on /proc being available. If you know what to look for a 'grep -a {someSearchTerm} /proc/[0-9]*/cmdline' can give you info. But obviously no realtime process stats unless you query the other related proc/{pid}/* entries. If you want to troubleshoot the issue here then listing (if relevant) HW specs, kernel version, applications, knowing which changes were made before this behaviour appeared and checking system and daemon logs and posting exact error messages may help.
 
Old 02-04-2011, 06:13 AM   #3
damade
LQ Newbie
 
Registered: Feb 2011
Distribution: Red hat, Solaris, AIX, HP-UX, FreeBSD
Posts: 15

Original Poster
Rep: Reputation: 2
'grep -a {someSearchTerm} /proc/[0-9]*/cmdline' would hang the session. because every command trying to read data on /proc/$pid was hanging.

Some fellow told me it was a command to read that info in the kernel memory (not /proc) but he dont know how to use it.

someone know it ?
 
Old 02-04-2011, 11:04 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by damade View Post
'grep -a {someSearchTerm} /proc/[0-9]*/cmdline' would hang the session. because every command trying to read data on /proc/$pid was hanging.
You know that for a fact because:
- you straced your "ps,top, etc" commands previously to show blocked syscalls?
- you actually tried grep and the strace shows the reasons why it wouldn't work?
If so posting strace results may be interesting. If you didn't: bummer. No "evidence". Regardless I think you should try to find out what changed on the system that causes hangs.
 
  


Reply



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
C: Get cmdline from /proc filesystem nwarrenfl Programming 8 12-01-2009 02:57 PM
pmap or /proc/<pid>smap or /proc/<pid>/status iQoder Linux - Newbie 1 07-16-2009 06:32 PM
scripting question: Extract a particular word from /proc/cmdline kushalkoolwal Programming 3 05-14-2008 02:48 AM
many /proc/<id>/cmdline files empty kpachopoulos Linux - General 1 08-25-2006 09:16 AM
How do I get the cmdline of a process in proc DonCorleonne Programming 1 05-05-2005 09:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:42 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
Open Source Consulting | Domain Registration