LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-01-2003, 01: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



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

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

All times are GMT -5. The time now is 08:36 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