LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 08-01-2003, 02:37 AM   #1
Shashi
LQ Newbie
 
Registered: Aug 2003
Posts: 1

Rep: Reputation: 0
Unhappy How to View Threads per Process


The below code gives u the thrd count given a PID on HP-UX. The same is possible through the pstat kernel interface that HP_UX provides through the pstat_getproc call. The pstat interface is not available on linux, Is there any way to get at that info.

Tried also "ps -m" option but not implemented.

Shashi

>>>>Start
#include <sys/param.h>
#include <sys/pstat.h>
#include <sys/unistd.h>
#include <stdio.h>

main()
{
int pid;
struct pst_status pst;
printf("Enter pid number ... ");
scanf("%d",&pid);


if (pstat_getproc(&pst, sizeof(pst), (size_t)0, pid)!= -1)
printf("pid is %d, cmd is %s, # threads %d\n",pst.pst_pid,pst.pst_cmd,pst.pst_nlwps);
else
perror("pstat_getproc");
}

<<<<<<<<End
 
  


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
View threads with 0 posts newuser455 LQ Suggestions & Feedback 4 07-08-2005 07:15 PM
View all threads with 1 reply? iluvatar LQ Suggestions & Feedback 4 06-17-2004 10:18 AM
How can I view the threads where I have posted messages? Trying to Learn LQ Suggestions & Feedback 2 08-02-2003 12:29 PM
Threads And Process Penguinizer Programming 1 02-18-2003 10:39 PM
View more than 25 threads on the "view new posts" page lfslinux LQ Suggestions & Feedback 2 02-02-2002 01:07 PM


All times are GMT -5. The time now is 10:18 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration