LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2004, 11:31 AM   #1
linuxprogrammer
LQ Newbie
 
Registered: Jul 2004
Posts: 26

Rep: Reputation: 15
Question 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?
 
Old 07-21-2004, 11:44 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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 ;-)
 
Old 07-21-2004, 11:52 AM   #3
linuxprogrammer
LQ Newbie
 
Registered: Jul 2004
Posts: 26

Original Poster
Rep: Reputation: 15
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.
 
Old 07-21-2004, 12:47 PM   #4
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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)
 
Old 07-21-2004, 01:31 PM   #5
linuxprogrammer
LQ Newbie
 
Registered: Jul 2004
Posts: 26

Original Poster
Rep: Reputation: 15
yeah, i think u've solved my problem. Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 07:26 AM
Assigning names in Python DiagonalArg Programming 3 07-27-2005 03:09 PM
assigning permissions ziox Programming 1 01-10-2005 09:13 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM
assigning static ip vcheah Linux - Networking 5 12-25-2001 06:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration