Preventing multiple instances of a process

In QNX6, what is the recommended way to test to see if your
[server/resource manager] process is already running and if so, quit. I
can’t test the existence of any prefix as it can be user defined and
therefore cannot be relied on to be accurate. In QNX4 I could have it
attach a name and test for that, but that approach of course no longer
applies.


Thanks,

Geoff.

Geoff <geoff@rtts.com.au> wrote:

In QNX6, what is the recommended way to test to see if your
[server/resource manager] process is already running and if so, quit. I
can’t test the existence of any prefix as it can be user defined and
therefore cannot be relied on to be accurate. In QNX4 I could have it
attach a name and test for that, but that approach of course no longer
applies.

In the simple (local) case, name_attach() for a second attach of the
same local name will fail with errno 17 (EEXISTS).

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Worked fine. Thanks.

Geoff.

David Gibbs wrote:

Geoff <> geoff@rtts.com.au> > wrote:
In QNX6, what is the recommended way to test to see if your
[server/resource manager] process is already running and if so, quit. I
can’t test the existence of any prefix as it can be user defined and
therefore cannot be relied on to be accurate. In QNX4 I could have it
attach a name and test for that, but that approach of course no longer
applies.

In the simple (local) case, name_attach() for a second attach of the
same local name will fail with errno 17 (EEXISTS).

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.