stdipc: ftok --
standard interprocess communication package
key_t ftok(const char path, int id);
All interprocess communication facilities
require the user to supply a key
to be used by the
system calls to obtain interprocess communication identifiers.
One suggested method for forming a key
is to use the
subroutine described below.
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 some standard is not adhered to,
it will be possible for unrelated processes
to unintentionally interfere with
each other's operation.
It is still possible to interface intentionally.
it is strongly suggested that
the most significant byte of a key
in some sense
refer to a project
so that keys do not conflict
across a given system.
returns a key
that is usable in subsequent
must be the path name
of an existing file
that is accessible
to the process.
is a character
that uniquely identifies
will return the same key
for linked files
when called with the same
and that it will return
different keys when
called with the same file name
does not exist
or if it is not accessible
to the process.
If the file whose path is passed
is removed when keys still refer to the file,
future calls to
with the same path and id
will return an error.
If the same file is recreated,
is likely to return a different key
than it did the original time it was called.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004