SHARE

Control file access

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
SHARE:share_spec

Arguments

share_spec

One of the following identifiers or corresponding values: (n)

Q_EXCL_RW or 0

Allow only exclusive read and write access for the file. With this option set, other users cannot access the file.

Q_EXCL_RO or 1

Allow read‑only access for the file. With this option set, other users can read but not write to the file.

Q_NO_EXCL or 2

Allow other users to both read and write to the file.

Discussion

The SHARE qualifier specifies whether a file can be accessed by other users.

To achieve the exclusive access of Q_EXCL_RW and Q_EXCL_RO, the systems file permissions must allow write access to the file.

The default share_spec value depends on the mode in which the file was opened: If the file was opened in input or update mode, both read and write access is allowed by default (that is, Q_NO_EXCL or 2); however, if the file was opened in output or append mode, only exclusive access is allowed (that is, Q_EXCL_RW or 0).

On UNIX, except on Solaris systems, setting the LOCK:Q_NO_LOCK qualifier overrides an exclusively locked file that was opened using an exclusive SHARE qualifier (either Q_EXCL_RW or Q_EXCL_RO). Except on Solaris systems with system option #33 set, opening a file with Q_EXCL_RO generates a “File in use” error when another process has the same file open with Q_EXCL_RO, regardless of the OPEN mode.

On OpenVMS, opening a file Q_EXCL_RW minimizes lock activity.

The SHARE qualifier has no effect on an OPEN statement where the OPEN mode specified is either append (A) or output (O).

See also