stdipc(3c) DG/UX 4.30 stdipc(3c)
NAME
ftok - standard interprocess communication package
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
keyt ftok(path, id)
char *path;
char id;
DESCRIPTION
All interprocess communication facilities require the user
to supply a key to be used by the msgget(2), semget(2), and
shmget(2) system calls to obtain interprocess communication
identifiers. One way to form a key is to use the ftok
subroutine described below. Another way is to include the
project ID in the most significant byte and to use the
remaining bytes as a sequence number.
There are many other ways to form keys; each system must
define standards for forming them. If some standard is not
adhered to, unrelated processes might interfere with each
other's operation. Therefore, the most significant byte of
a key should in some sense refer to a project so that keys
do not conflict.
Ftok returns a key based on path and id that is usable in
subsequent msgget, semget, and shmget system calls. Path
must be the path name of an existing file that is accessible
to the process. Id is a character that uniquely identifies
a project. Note that ftok will return the same key for
linked files when called with the same id and that it will
return different keys when called with the same filename but
different ids.
SEE ALSO
intro(2), msgget(2), semget(2), shmget(2).
DIAGNOSTICS
Ftok returns (keyt) -1 if path does not exist or if it is
not accessible to the process.
WARNING
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 will return an error. If the same file is
recreated, then ftok will likely return a key different from
the one it returned the first time it was called.
Licensed material--property of copyright holder(s) Page 1