Managing Access to Shared File-Based Stores

To prevent two EMS servers from using the same store file, each server restricts access to its store file for the duration of the server process. This section describes how EMS manages locked file-based stores. Shared store locking for grid stores and FTL stores is handled directly by ActiveSpaces and FTL, respectively.

Windows

On Windows platforms, servers use the standard Windows CreateFile function, supplying FILE_SHARE_READ as the dwShareMode (third parameter position) to restrict access to other servers.

UNIX

On UNIX platforms, servers use the standard fcntl operating system call to implement cooperative file locking:

    struct flock fl;
    int err;

    fl.l_type = F_WRLCK;
    fl.l_whence = 0;
    fl.l_start = 0;
    fl.l_len = 0;

    err = fcntl(file, F_SETLK, &fl);

To ensure correct locking, we recommend checking the operating system documentation for this call, since UNIX variants differ in their implementations.