Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Algorithm to Support the Emulation of the UNIX FTOK() System Call in OS/2

IP.com Disclosure Number: IPCOM000112981D
Original Publication Date: 1994-Jun-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 2 page(s) / 57K

Publishing Venue

IBM

Related People

Hidalgo, D: AUTHOR [+2]

Abstract

The emulation of UNIX* system calls is an accepted approach to porting UNIX C source code to OS/2**. The differences in interprocess communication support between these two operating systems is accentuated by the lack of a mechanism in OS/2 that can provide a unique numeric key value that can be used with emulated semaphore, shared memory and message queue functions. It is therefore necessary to provide a mechanism to emulate the UNIX ftok() function in OS/2, which is the function that provides unique numeric keys in UNIX, for use with Inter Process Communication(IPC) functions. There is no similar system call in OS/2. This invention provides an algorithm that can be used to obtain a very close emulation of the ftok() call in OS/2.

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

Algorithm to Support the Emulation of the UNIX FTOK() System Call
in OS/2

      The emulation of UNIX* system calls is an accepted approach to
porting UNIX C source code to OS/2**.  The differences in
interprocess communication support between these two operating
systems is accentuated by the lack of a mechanism in OS/2 that can
provide a unique numeric key value that can be used with emulated
semaphore, shared memory and message queue functions.  It is
therefore necessary to provide a mechanism to emulate the UNIX ftok()
function in OS/2, which is the function that provides unique numeric
keys in UNIX, for use with Inter Process Communication(IPC)
functions.  There is no similar system call in OS/2.  This invention
provides an algorithm that can be used to obtain a very close
emulation of the ftok() call in OS/2.

      The detailed algorithm for an OS/2 emulation of the UNIX ftok()
system call is shown below.

     key_t ftok(char * Filepath, char ID)
     BEGIN

       Define LSW and MSW as short int variables to contain the least
         and most significant words of the result.

       Make sure ID isn't null.

       Check that file indicated by Filepath exists.
        Return error if file doesn't exist or if ID is null.

       Call OS/2 DosQueryPathInfo() to get the information block for
         Filepath.

       Use the date and time of creation of the file indicated by
         Filepath to build LSW as follows:
         BEGIN
           Factor in the ID by combining it with the file creation
year, which is the least distinguishing factor used.
           This is done by adding the ordinal of the character
           indicated by...