From owner-freebsd-questions Wed Sep 23 13:35:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA09892 for freebsd-questions-outgoing; Wed, 23 Sep 1998 13:35:15 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA09798 for ; Wed, 23 Sep 1998 13:34:44 -0700 (PDT) (envelope-from andre.albsmeier@mchp.siemens.de) X-Envelope-Sender-Is: andre.albsmeier@mchp.siemens.de (at relayer david.siemens.de) Received: from mail.siemens.de (salomon.siemens.de [139.23.33.13]) by david.siemens.de (8.9.1a/8.9.1) with ESMTP id WAA23895 for ; Wed, 23 Sep 1998 22:34:33 +0200 (MET DST) Received: from curry.mchp.siemens.de (daemon@curry.mchp.siemens.de [146.180.31.23]) by mail.siemens.de (8.9.1a/8.9.1) with ESMTP id WAA07456 for ; Wed, 23 Sep 1998 22:34:33 +0200 (MET DST) Received: (from daemon@localhost) by curry.mchp.siemens.de (8.8.8/8.8.8) id WAA00796 for ; Wed, 23 Sep 1998 22:34:34 +0200 (CEST) From: Andre Albsmeier Message-Id: <199809232034.WAA04817@internal> Subject: Re: How to get the PID before a program is run? (No joke :-) In-Reply-To: <199809231855.LAA06120@home> from TS Waterman at "Sep 23, 98 11:55:07 am" To: waterman@acm.org Date: Wed, 23 Sep 1998 22:34:31 +0200 (CEST) Cc: freebsd-questions@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > Andre Albsmeier writes: > >> In the last episode (Sep 23), Andre Albsmeier said: > >> > someone wrote: > >> > > In message <199809230729.JAA12131@internal>, Andre Albsmeier wrote: > >> > > } I want to start a program but I need its PID before it is run. > >> > > } One way would be to load the program and send a -STOP signal very > >> > > } quickly. Then I have got the PID, can do some things and send a > >> > > } -CONT signal when finished. > [...] > >Yes, the thing with the two scripts appears to be the only way. > > > Out of curiosity, could you post a short description of > _why_ you want the PID before running the process. ... > just curious, OK, maybe you have heard about the StarOffice4 SP3 problem: Staroffice looks in /proc/%u/cmdline to get its commandline parameters. %u is here the PID of the process. Since this thig doesn't exist in FreeBSD, StarOffice hangs when being started. I have patched the two StarOffice files that contain this thing so, that now the file /tmp/so_cmd_line is accessed. Before running StarOffice, the cmdline is put there in Linux style by a shell script. So it is possible to use commandline args. SO4SP3 runs very nice in this way. What I wanted to use now is to get that %u thing working. I have thought of something like this: 1. Build /tmp/socmdline%u where %u is the PID under which SO4 will run. 2. Execute SO4 3. Remove /tmp/socmdline%u It's is really not very important to do this, because the only problem that might appear with my first version is when two users start SO4 at the same time on the same machine since the /tmp/so_cmd_line gets messed up in this case. -Andre P.S. I cc this to -questions now, since I already have been asked by 2 other persons why I want to do this shit :-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message