Browse Prior Art Database

Abstracted File Lock Manager to Support the Emulation of UNIX FCNTL() and LOCKFX() System Calls in OS/2

IP.com Disclosure Number: IPCOM000114704D
Original Publication Date: 1995-Jan-01
Included in the Prior Art Database: 2005-Mar-29
Document File: 6 page(s) / 184K

Publishing Venue

IBM

Related People

Hidalgo, DS: AUTHOR [+2]

Abstract

Disclosed is an invention which provides an implementation of a manager for abstracted UNIX* style file locks. These type of file locks are not directly supported by OS/2**, and are necessary for implementing OS/2 emulations of the fcntl(), lockfx(), open() and close() UNIX functions.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 29% of the total text.

Abstracted File Lock Manager to Support the Emulation of UNIX FCNTL()
and LOCKFX() System Calls in OS/2

      Disclosed is an invention which provides an implementation of a
manager for abstracted UNIX* style file locks.  These type of file
locks are not directly supported by OS/2**, and are necessary for
implementing OS/2 emulations of the fcntl(), lockfx(), open() and
close() UNIX functions.

      An approach used to port program code written for UNIX
platforms to other operating systems such as OS/2 is to emulate the
UNIX system calls in those operating systems, along with all the
necessary semantics of those calls and the necessary header file
definitions expected by the ported source code.  Some UNIX system
calls are easier to emulate in OS/2 than others.  Of particular
interest are the emulation of the UNIX file locking system
calls.  UNIX file locking and control system calls have significantly
different interface and semantics from those in OS/2.  In particular,
the lack of a file lock abstraction that provides the file locking
semantics expected by the operations supported by the fcntl() and
lockfx() system calls, such as obtaining a lock that would block an
attempt to set a lock on a given section of a file, or the file lock
characteristic that allows the release of file locks of sections of a
file to be released when the file is closed, and the capability of
having these semantics work in interprocess environments.  All of the
above means that there is absolutely no direct correspondence between
any type of OS/2 file locking semantics and those of UNIX
environments.

      This invention provides an implementation of a manager for
abstracted UNIX style file locks.  The implementation uses abstracted
data structures along with OS/2 system calls and OS/2 resources to
provide a file locking layer that can be used to implement very close
OS/2 emulations of the UNIX fcntl() and lockfx() system calls that
are used to lock sections of files, and to control some file aspects
of file behavior.

      The abstract lock manager for OS/2 provides the following
interface, whose details are also listed below: (1) A CPP_LOCK
structure that represents a UNIX style file lock.  (2) A set of
constants that symbolize the state of the lock.  (3) A set of
constants that symbolize the actions that are to be performed by
calls to cpp_lock_up().  (4) An interface function cpp_lock_up(),
which allows manipulation of locks by the fcntl() and lockfx()
emulated system calls.  (5) An interface function
cpp_put_free_locklist(), which is called by the emulated close()
system call to support the release of all locks held by a process on
a file as is required for UNIX style locks.

      The detailed description of the CPP_LOCK structure that
represents a UNIX style lock is shown below in C language syntax.
  struct CPP_LOCK
  {
    struct CPP_LOCK * nextlock; /* Link list of locks on a file.  */
    short    l_state;  ...