Re: How to find the pid of the a given process.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Mar 12, 2007 at 09:43:44PM +0530, Prasad Joshi wrote:
> I have given an assignment to find out the pid of the process from its's
> name. I am not supposed to use proc filesystem as well as ps output.

Impossible. The proc filesystem is the only way to figure out
information about other processes.

> I am
> supposed to write a USER SPACE C program input to it will be a program name
> string, say bash, and then it should print corresponding PID.

And what is supposed to happen when there are several bash processes?

> The next part of the assignment is to find the PPID of a given process and
> then print it's tree till init process.

The pstree program already does what you want, no need to reinvent the
wheel.


Erik

- -- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF9YR+/PlVHJtIto0RAhR3AJ9pHEJkKvgbqE9svxnPRcb8jPba6wCfWAD6
z2cgCAPJ3hMiYgcPK8IvMNE=
=V+El
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux