LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   assigning a process id (https://www.linuxquestions.org/questions/linux-newbie-8/assigning-a-process-id-207907/)

linuxprogrammer 07-21-2004 11:31 AM

assigning a process id
 
I want to start a process, and assign it a pid myself, so that later on I can kill it. How can I do that, and how can I take care that the pid is not already being used by another process?

acid_kewpie 07-21-2004 11:44 AM

you can't. most functions in most languages will, when executing an external process, return the external pid for your use later. the principle of being able to pick your own pid's doesn't make sense, and is pretty nonsensical.. no offense ;-)

linuxprogrammer 07-21-2004 11:52 AM

Then, can u tell me how can I recover the pid of the process i've just started. I have to do all this within a program, so I can't just do 'ps' and look for the pid.

SciYro 07-21-2004 12:47 PM

http://www.delorie.com/gnu/docs/glibc/libc_566.html

is that what you need?

http://www.delorie.com/gnu/docs/glibc/libc_563.html

or that? (the first one comes from the second one, just for small note)

linuxprogrammer 07-21-2004 01:31 PM

yeah, i think u've solved my problem. Thanks:D


All times are GMT -5. The time now is 06:16 PM.