ftok(3C)ftok(3C)NAMEftok() - create interprocess communication identifier
All interprocess communication facilities require the user to supply a
key to be used by the and system calls to obtain interprocess communi‐
cation identifiers (see msgget(2), semget(2), and shmget(2)).
returns a key based on path and id that is usable in subsequent and
The parameters for the function are as follows:
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. This means that only the low order
8-bits of id are significant. Note that
returns the same key for linked files when
called with the same id and that it returns
different keys when called with the same
file name but different ids.
returns if path does not exist or if it is not accessible to the
The following call to returns a key associated with the file myfile and
If the file whose path is passed to 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.
SEE ALSOintro(2), msgget(2), semget(2), shmget(2), thread_safety(5).