Welcome! Log In Create A New Profile

Advanced

Replicating ps -ef function

Posted by babazinga 
Replicating ps -ef function
May 10, 2015 03:50PM
Hey everyone, I am trying to create my own ps -ef function inside a linux kernel. For example, ps -ef prints all the information currently running on the computer. To start off I only want to print like 2-3 processes. For example, when the user runs the module it should output (notice how it is the same format as the ps -ef function):

UID PID PPID C STIME TTY TIME CMD
root 1 0 0 15:23 ? 00:00:05 /sbin/init
root 2 0 0 15:23 ? 00:00:05 [kthreadd]
root 3 2 0 15:23 ? 00:00:05 [ksoftirqd/0]

On terminal you can print a process info by knowing the process id (PID): ps -p 1
Is there any built in linux function I can use that does the same thing?
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 6 plus 4?
Message: