Welcome to the Linux Foundation Forum!

Replication the ps -ef function

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?

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training