How to reset process ID in QNX

1k views Asked by At

If someone knows how to rest process ID in QNX, please let me know. I am searching the web but looks like nothing to be found. I actually need to write a script to do the following:

  1. Look for current process ID
  2. If PID is bigger than some particular value then reset PID and start my process
  3. If not bigger, then start my process

In order to do that I only need the info on how to reset process ID in QNX OS. Thank in advance.

1

There are 1 answers

0
kmort On

The QNX Neutrino kernel assigns PIDs to each process as it is started. You cannot choose the PID you get, only work with the one you are given. There is no concept of resetting PID count in QNX.

To find the PID, if you know the process name, simply use:

ps -e | grep processname | awk {'print $1'}

This will return the process ID of process processname. If you're doing this in a script, you can assign the result to a variable using:

varname=`ps -e | grep processname | awk {'print $1'}`

Make sure to use backticks around the main expression.

Hope this helps.