Manage Access to Shared Store Files

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 store files.

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.