(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: CRELNT, next: DACEFC)


CREPRC - Create Process


Creates a subprocess or detached process on behalf of the calling process.

Format:

    pidadr = vms_sys.creprc ([image] ,[input] ,[output] ,[error] ,\
                             [prvadr] ,[quota] ,[prcnam] ,[baspri] ,\
                             [uic] ,[mbxunt] ,[stsflg] )
Returns:
pidadr
Process identification (PID) of the newly created proces.
Arguments:
image
Name of the image to be activated in the newly created process. The image name can have a maximum of 63 characters - this is not enforced by the Python interface to SYS$CREPRC.
input
Equivalence name to be associated with the logical name SYS$INPUT in the logical name table of the created process.
output
Equivalence name to be associated with the logical name SYS$OUTPUT in the logical name table of the created process.
error
Equivalence name to be associated with the logical name SYS$ERROR in the logical name table of the created process.
prvadr
Privileges to be given to the created process. This must be a Python long integer. Bitmasks values (PRV_M_name) are available in module 'vms_prvdef'. Usage of the privilege bitmasks is explained in GENMAN 'programming, processes, privileges'.
quota
Process quotas to be established for the created process.

The process quota list must be delivered to the Python interface as a 'tuple of tuples' - see the examples section below.

See the system services reference manual for explanations about quotas.

prcnam
Process name to be assigned to the created process. It can be a 1- to 15-character process name string, but the length is not enforced by the Python interface to SYS$CREPRC.
baspri
Base priority for the new process.
uic
User identification code (UIC) to be assigned to the created process. This must be a Python integer. Bits 0 - 15 indicate the UIC member number and bits 16 - 31 indicate the UIC group number.
mbxunt
Unit number of a mailbox to receive a termination message when the created process is deleted. This must be a Python integer, but the system service expects the 'mbxunt' argument to be a 16-bit word containing this number - the Python interface enforces this.
stsflg
Options selected for the created process.

Bitmask values (PRC_M_name) for this argument are in module 'vms_prcdef'.

Examples:
>>> import vms_sys

>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE','CREPRC_1.COM',
... 'CREPRC_1.LOG', None, None, None, 'CREPRC_1P',3)
>>> l_pid
343
>>> import vms_lib
>>> vms_lib.getjpi ('JPI$_PRCNAM',l_pid)
(343, 'CREPRC_1P')
>>> # test done, remove process from system to clean up
>>> vms_sys.delprc (l_pid)
343        <-- DELPRC returns the PID - please look up
>>> #             the description of DELPRC why this is so

$ type CREPRC_1.COM
$ show process/quota
$ wait 01:00:00
$ exit 1
$! -----
$ type CREPRC_1.LOG
$ show process/quota

15-OCT-1998 17:43:26.96   User: ZESSIN     Process ID:   00000157
                          Node: HERE       Process name: "CREPRC_1P"

Process Quotas:
 Account name: HOME
 CPU limit:                    Infinite  Direct I/O limit:     100
 Buffered I/O byte count quota:  121536  Buffered I/O limit:   100
 Timer queue entry quota:            29  Open file quota:      297
 Paging file quota:               36492  Subprocess quota:       9
 Default page fault cluster:         64  AST quota:             99
 Enqueue quota:                    4000  Shared file limit:      0
 Max detached processes:              0  Max active jobs:        0
$ wait 01:00:00
$!

----------------------------------------

>>> import vms_prcdef
>>> l_stsflg = vms_prcdef.PRC_M_DETACH + \
...            vms_prcdef.PRC_M_NOUAF  + \
...            vms_prcdef.PRC_M_HIBER
>>> process_quota_list = ( ('PQL$_ENQLM',1111), ('PQL$_FILLM', 123) )
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, process_quota_list, 'CREPRC_1P',3,
... None, None, l_stsflg)        # base priority -----^
>>>
>>> import vms_lib
>>> vms_lib.getjpi ('JPI$_ENQLM', l_pid)
(355, 1111)
>>> # ^^^^
>>> vms_lib.getjpi ('JPI$_FILLM', l_pid)
(355, 123)
>>> # ^^^
>>>
>>> hex(l_pid)
'0x163'
   ^^^------------------------------vvv
$! -----                            !!!
$ show process/quota/identification=163

15-OCT-1998 19:14:24.80   User: ZESSIN     Process ID:   00000163
                          Node: HERE       Process name: "CREPRC_1P"

Process Quotas:
 Account name: HOME
 CPU limit:                    Infinite  Direct I/O limit:     100
 Buffered I/O byte count quota:   39872  Buffered I/O limit:   100
 Timer queue entry quota:             8  Open file quota:      123
    PQL$_FILLM set ------------------------------------------->^^^
 Paging file quota:               31997  Subprocess quota:       8
 Default page fault cluster:         64  AST quota:            100
 Enqueue quota:                    1111  Shared file limit:      0
    PQL$_ENQLM set --------------->^^^^
 Max detached processes:              0  Max active jobs:        0
$! -----
$ show process /identification=163

15-OCT-1998 19:17:04.13   User: ZESSIN     Process ID:   00000163
                          Node: HERE       Process name: "CREPRC_1P"

Terminal:
User Identifier:    [HOME,ZESSIN]
Base priority:      3                <-- base priority set
Default file spec:  Not available
$! -----
$ stop /identification=163

----------------------------------------

>>> # specify a different UIC
>>> l_uic = 0x120035        # [22,65]
>>> # show octal
>>> print oct(l_uic/65536), oct(l_uic & 0xffff)
022 065
>>>
>>> import vms_prcdef
>>> l_stsflg = vms_prcdef.PRC_M_DETACH + \
...            vms_prcdef.PRC_M_NOUAF  + \
...            vms_prcdef.PRC_M_HIBER
>>>
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_1P',None,
... l_uic, None, l_stsflg)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (36, '%SYSTEM-F-NOPRIV, insufficient privilege\
 or object protection violation')

$ set process/privilege=detach

>>> 
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_1P',None,
... l_uic, None, l_stsflg)
>>> hex(l_pid)
'0x161'
>>>

$ show process/identification=161

16-OCT-1998 19:41:58.26   User: ZESSIN     Process ID:   00000161
                          Node: HERE       Process name: "CREPRC_1P"

Terminal:
User Identifier:    [22,65]
Base priority:      0                <-- base priority was 'None'
Default file spec:  Not available
$

----------------------------------------

>>> import vms_prvdef
>>> q_prvadr = vms_prvdef.PRV_M_ALLSPOOL + \
...            vms_prvdef.PRV_M_DIAGNOSE + \
...            vms_prvdef.PRV_M_BUGCHK
>>>
>>> # the privilege mask is a quadword,
>>> #   which is represented by a Python long integer
>>> print q_prvadr
8388688L
>>>
>>> import vms_prcdef
>>> l_stsflg = vms_prcdef.PRC_M_DETACH + \
...            vms_prcdef.PRC_M_NOUAF  + \
...            vms_prcdef.PRC_M_HIBER
>>>
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, q_prvadr, None, 'CREPRC_1P',3,
... None, 999, l_stsflg)
>>> hex (l_pid)
'0x160'
>>>
   ^^^------------------------------------vvv
$show process /privileges /identification=160

16-OCT-1998 19:24:23.48   User: ZESSIN       Process ID:   00000160
                          Node: HERE         Process name: "CREPRC_1P"

Authorized privileges:
 ALLSPOOL  BUGCHK    DIAGNOSE

Process privileges:
 ALLSPOOL             may allocate spooled device
 BUGCHK               may make bug check log entries
 DIAGNOSE             may diagnose devices

Process rights:
 INTERACTIVE
 LOCAL

System rights:
 SYS$NODE_HERE
$ analyze /system

VAX/VMS System analyzer

SDA> set process "CREPRC_1P"
Process index: 0020   Name: CREPRC_1P   Extended PID: 00000160
--------------------------------------------------------------
Status : 001C0009 res,inquan,phdres,hiber,login
Status2: 00009800 class_scheduled,class_supplied,windfall
PCB address            815192C0   JIB address            8151DEC0
PHD address            81F09A00   Swapfile disk address  00000000
Master internal PID    00050020   Subprocess count              0
Internal PID           00050020   Creator internal PID   00000000
Extended PID           00000160   Creator extended PID   00000000
State                     HIB     Termination mailbox        03E7
[...]         vvv--------------------------------------------^^^^
SDA> evaluate 3E7
Hex = 000003E7   Decimal = 999          BUG$_SYSTRMERR+00007
SDA>

----------------------------------------

>>> process_quota_list = ( ('PQL$_FILLM', 123), ('PQL$_BAD_LM',1) )
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, process_quota_list, 'CREPRC_1P',3,
... None, None, None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 6: quota-list - unknown quota code: PQL$_BAD_LM
>>>

----------------------------------------

>>> # a process name must be unique in a UIC group
>>>
>>> import vms_prcdef
>>> l_stsflg = vms_prcdef.PRC_M_DETACH + \
...            vms_prcdef.PRC_M_NOUAF  + \
...            vms_prcdef.PRC_M_HIBER
>>>
>>> # start first process
>>> l_pid1 = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_TST',3,
... None, None, l_stsflg)
>>> hex(l_pid1)
'0x164'
>>> # try to start second process with same name
>>> l_pid2 = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_TST',3,
... None, None, l_stsflg)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (148, '%SYSTEM-F-DUPLNAM, duplicate name')
>>> # test done, remove first process from system to clean up
>>> vms_sys.delprc (l_pid1)
356        <-- DELPRC returns the PID - please look up
>>> #             the description of DELPRC why this is so

----------------------------------------

>>> # the termination mailbox unit number is a 16-bit value
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_TST',3,
... None, 65536, None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 10: mbxunt - must be a 16-bit integer or None
>>>

----------------------------------------

>>> # the system service reports invalid status flags
>>> l_stsflg = -1
>>> l_pid = vms_sys.creprc('SYS$SYSTEM:LOGINOUT.EXE',None,
... None, None, None, None, 'CREPRC_TST',3,
... None, None, l_stsflg)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (380, '%SYSTEM-F-IVSTSFLG, invalid status flag')
>>>

@@ more examples for CREPRC

(go to: table of contents, index, list of vms_sys, prev: CRELNT, next: DACEFC)

24-MAR-1999 ZE.