(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_sys, prev: SETDDIR, next: SETEF)


SETDFPROT - Set Default File Protection


Allows you to read and write the default file protection for the process.

Please note that Python uses the C RTL for file I/O. Usage of the umask() function can render this setup useless.

Format:

    cur-def-prot = vms_sys.setdfprot ([new-def-prot])
Returns:
cur-def-prot
Current /old default protection value. This is an unsigned 16-bit integer. Read the system documentation about how the protection bits are encoded.
Arguments:
new-def-prot
New protection value. This must be an unsigned 16-bit integer. Read the system documentation about how the protection bits are encoded.
Examples:
$ SHOW PROTECTION
  SYSTEM=RWED, OWNER=RWED, GROUP=RE, WORLD=NO ACCESS
$

$ PYTHON
[ banner omitted ]
>>> import vms_sys

>>> old_prot = vms_sys.setdfprot ()
>>> print old_prot
64000
>>>

>>> old_prot = vms_sys.setdfprot (None)
>>> print old_prot
64000
>>> hex (old_prot)
'0xfa00'
>>>


>>> old_prot = vms_sys.setdfprot (0x1234)
>>> hex (old_prot)
'0xfa00'
>>> new_prot = vms_sys.setdfprot (None)
>>> hex (new_prot)
'0x1234'
>>>
>>> import vms_lib
>>> vms_lib.do_command ('SHOW PROTECTION')
  SYSTEM=RWD, OWNER=ED, GROUP=RED, WORLD=WED
$

>>> vms_sys.setdfprot ('X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 1: new-def-prot - must be positive\
 16-bit integer or None
>>>

(go to: table of contents, index, list of vms_sys, prev: SETDDIR, next: SETEF)

01-JAN-1999 ZE.