Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 1998 22:34:31 +0200 (CEST)
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        waterman@acm.org
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: How to get the PID before a program is run? (No joke :-)
Message-ID:  <199809232034.WAA04817@internal>
In-Reply-To: <199809231855.LAA06120@home> from TS Waterman at "Sep 23, 98 11:55:07 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809232034.WAA04817>