Visit Our UNIX and Linux User Community


getting certain info for all processes currently running


 
Thread Tools Search this Thread
Top Forums Programming getting certain info for all processes currently running
# 1  
Old 03-24-2005
getting certain info for all processes currently running

i am writing a utility that displays information about all the running processes in the /proc directory.

I do not know how to get the following information for each of the processes in the /proc directory:

-effective user id
-effective user name
-effective group id
-effective group name
-tty
-execution time of process

I understand how to get the user id. It is from the stat struct. And to get the user name, I just pass the user id to getpwuid(). Its the same with the group id and group name.

But I''m stuck at where I can obtain the effective user id and effective group id and how to get their effective names.

Also, where can i obtain information about which terminal the current process is being controlled by? It should be in the form "/pts/#"

Also, how can i find out how long a process has been executing?

Thank you.
# 2  
Old 03-25-2005
The /proc/<pid>/psinfo file contains the details that you require. How those details are to be extracted, probably have to read the man page in detail for that.
# 3  
Old 03-25-2005
I checked under directory /proc/pid/ and there is no such file called "psinfo."

There is a file called stat but that does not contain the information on the effective user and group id and names.

I figured out how to get the tty.

I still don't know how to get the execution time.

is there anyone else knowledgeable on this?
# 4  
Old 03-25-2005
/proc works differently from one os to another. Maybe you should mention which os you are using.

Previous Thread | Next Thread
Test Your Knowledge in Computers #617
Difficulty: Medium
If you place two string literals side by side, they are automatically concatenated by Python.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies

2. Homework & Coursework Questions

Display info about users (UID GID processes terminal)

I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made. 1. The problem statement, all variables and given/known data: The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies

3. Solaris

Sendmail processes not running

Hi All! I am trying to get sendmail to work but unsuccessfull...when I run ps -ef | grep sendmail root 10578 10561 0 11:01:24 pts/1 0:00 grep sendmail I do not see its processes When I run the following commands: bash-3.00# svcs sendmail svcs: Pattern 'sendmail' doesn't match... (9 Replies)
Discussion started by: fretagi
9 Replies

4. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

5. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

6. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

7. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (5 Replies)
Discussion started by: Ikebana
5 Replies

8. Shell Programming and Scripting

Everyday appending info about all processes which are active..

I have problem but i didnt solve it. Could you help me? :) Problem: Everyday at 12.17 we will append information to the file "log" about users who are logged and the information about all processes which are active to the user_activity file in our home directory.. I know that I must use cron... (1 Reply)
Discussion started by: mavikartal
1 Replies

9. UNIX for Dummies Questions & Answers

how to find all processes that are running

Hi i've been googling a lot but can't find an answer. All I would like to know is how to find out all processes that are running on a machine. I know ps gives all YOUR processes. thanks (9 Replies)
Discussion started by: speedieB
9 Replies

10. Shell Programming and Scripting

Running two processes in background

hi there, here's what i need in my korn-shell: ... begin korn-shell script ... nohup process_A.ksh ; nohup process_B.ksh & ... "other stuff" ... end lorn-shell script in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies

Featured Tech Videos