(go to: table of contents, index, list of vms_sys, prev: GET_SECURITY, next: HIBER)
Format:
GRANTID - Grant Identifier to Process
Adds the specified identifier record to the rights list of the process
or the system.
28-SEP-1998 ZE.
setflg, targpid, id, prvatr = vms_sys.grantid \
([pidadr] [,prcnam] [,id] [,name])
Returns:
Arguments:
The targed PID (targpid) is always returned - it is as if you have specified
a '0' value for the 'pidadr' argument.
If an error happens, then vms_sys.grantid() raises a Python exception.
The Python function returns a tuple of 2 integers - not a quadword
represented by a Python long integer. The first element contains the binary
identifier code. The second element contains the attributes. Bitmask values
for these attributes are defined in module
'vms_kgbdef'.
Examples:
The Python function only accepts a tuple of 2 integers - not a quadword
represented by a Python long integer. The first element contains the binary
identifier code. The second element contains the attributes. Bitmask values
for these attributes are defined in module
'vms_kgbdef'.
$ show process /rights
2-SEP-1998 21:20:58.18 User: ZESSIN Process ID: 0000005B
Node: HERE Process name: "ZESSIN_FTA9"
Process rights:
INTERACTIVE
LOCAL
System rights:
SYS$NODE_HERE
$
>>> import vms_sys
>>> import vms_kgbdef
>>> pid = 91
>>> id = 0x80010011 # ID_1
>>> attr = vms_kgbdef.KGB_M_RESOURCE
>>> # show grant by ID (process identification and binary identifier)
>>> vms_sys.grantid (pid, None, (id,attr), None)
(0, 91, (-2147418095, 1), 0)
>>> print vms_kgbdef.KGB_M_RESOURCE
1
>>>
$ show process /rights
2-SEP-1998 21:33:41.94 User: ZESSIN Process ID: 0000005B
Node: HERE Process name: "ZESSIN_FTA9"
Process rights:
INTERACTIVE
LOCAL
ID_1 resource <--
System rights:
SYS$NODE_HERE
$
>>> # show grant by name (process name and identifier name)
>>> vms_sys.grantid (None, 'ZESSIN_FTA9', None, 'ID_2')
(0, 91, (-2147418094, 2), 0)
>>> id = -2147418094 # check
>>> namlen, nambuf, resid, attrib, id_ctx = vms_sys.idtoasc (id,0)
>>> nambuf
'ID_2'
>>>
$ show process /rights
2-SEP-1998 21:43:26.73 User: ZESSIN Process ID: 0000005B
Node: HERE Process name: "ZESSIN_FTA9"
Process rights:
INTERACTIVE
LOCAL
ID_1 resource
ID_2 dynamic <--
System rights:
SYS$NODE_HERE
$
>>> # put an identifier into the system rights list
>>> # -- requires SYSNAM privilege
>>> id = 0x80010011 # ID_1
>>> attr = vms_kgbdef.KGB_M_RESOURCE
>>> vms_sys.grantid (-1, None, (id,attr), None)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (10260, '%SYSTEM-F-NOSYSNAM, operation requires SYSNAM \
privilege')
[...]
>>> vms_sys.grantid (-1, None, (id,attr), None)
(0, -1, (-2147418095, 1), 0)
>>>
>>> attr = attr + vms_kgbdef.KGB_M_DYNAMIC
>>> vms_sys.grantid (-1, None, (id,attr), None)
(1, -1, (-2147418095, 3), 1)
| | | | |- old attributes (KGB_M_RESOURCE)
| | | |----- current attributes
| | |------------------ identifier value
| |----------------------- PID, -1 = system rights list
|-------------------------- setflg = 1 -- identifier was already
in the system rights list
>>>
$ show process /rights
2-SEP-1998 21:46:06.84 User: ZESSIN Process ID: 0000005B
Node: HERE Process name: "ZESSIN_FTA9"
Process rights:
INTERACTIVE
LOCAL
ID_1 resource
ID_2 dynamic
System rights:
SYS$NODE_HERE
ID_1 resource, dynamic <--
$
@@ GRANTID - more examples
>>>
(go to: table of contents,
index,
list of vms_sys,
prev: GET_SECURITY,
next: HIBER)