standard interprocess communication package
cc . . . -lc
key_t ftok(path, id)
All interprocess communication facilities
require you to supply a key that the
system calls use to obtain interprocess communication identifiers.
One suggested method for forming a key
is to use the ftok subroutine.
Another way to compose keys
is to include the project ID in the most significant byte
and to use the remaining portion as a sequence number.
There are many other ways to form keys,
but it is necessary for each system
to define standards for forming them.
If a standard is not adhered to,
unrelated processes may conflict.
the most significant byte of a key should
refer to a project.
ftok returns a key based on
path and id
that is usable in subsequent
msgget, semget, and shmget system calls.
path must be the pathname of an existing file
that is accessible to the process.
id is a character which uniquely identifies a project.
ftok returns the same key
for linked files when called with the same
id and returns different keys when
called with the same file name but different ids.
ftok returns (key_t) -1
if path does not exist or is not accessible
to the process.
If the file whose path is passed to ftok
is removed when keys still refer to the file,
future calls to ftok
with the same path and id
return an error.
If the same file is recreated, then ftok
is likely to return a different key
than it did the first time it was called.
ftok is not part of any currently supported standard;
it is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003