Operating System - OpenVMS
1753873 Members
7714 Online
108809 Solutions
New Discussion юеВ

Re: Setting and getting the process name?

 
SOLVED
Go to solution
Martin Cowie
Occasional Contributor

Setting and getting the process name?

This is a question from a longtime Unix developer with some degree of VMS understanding.

The C RTL gives me 'getpid()', but how can I get the process *name* instead? Furthermore, can I set my process name, and if so how?

All clues welcomed.

M.
6 REPLIES 6
Kris Clippeleyr
Honored Contributor

Re: Setting and getting the process name?

Martin,

Don't have a C routine at hand, but you can always call upon a system service from within a C routine.
The system service SYS$GETJPI[W] can pretty much return any information about the process. For setting the process name you have the system service SYS$SETPRN.

See also:

http://h71000.www7.hp.com/doc/82FINAL/4527/4527PRO.HTML

Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Ian Miller.
Honored Contributor

Re: Setting and getting the process name?

or LIB$GETJPI with the item code JPI$_PRCNAM
____________________
Purely Personal Opinion
Martin Cowie
Occasional Contributor

Re: Setting and getting the process name?

This is looking good, however, calling non RTL functions such as $GETJPI is a whole new world to me, and the ample docs you point me at leave me feeling bamboozled.

Could anyone volunteer some example code, that I might how to call this and other system services in ANSI C?

Your clues still welcomed,

M.

Volker Halle
Honored Contributor
Solution

Re: Setting and getting the process name?

Martin,

'Ask Compaq' is your friend ;-)

Example-C Using Lib$getjpi To Get Username Of Current Process

http://h18000.www1.hp.com/support/asktima/appl_tools/0095E0CC-F98FF880-1C02A1.html

Volker.
Kris Clippeleyr
Honored Contributor

Re: Setting and getting the process name?

Martin,

Attached a "get my process name" sample.

Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Kris Clippeleyr
Honored Contributor

Re: Setting and getting the process name?

Martin,

Attached a "set my process name" sample.

Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...