ftok() - Create key for IPC facilities.
#include <sys/ipc.h>
key_t ftok(const char *path, int id)
The ftok(3) call creates a key to be used by interprocess communication facilities (IPC). The key is created based on the path and id that can be used in subsequent calls to msgget(2), semget(2), and shmget(2).
The path must be the pathname of an existing file that the process can access. If the same file can be referred to by different path names (for instance, relative paths), all paths that refer to the same file will result in the same key.
The id is a character that uniquely identifies a particular project. If the low order 8 bits of id are 0, behavior is unspecified.
The ftok(3) call returns a key if it succeeds. Otherwise it returns (key_t and sets errno to indicate the error.
The ftok(3) function can fail for the following reasons:
This implementation of ftok(3) cannot distinguish between local and network drives, because the statvfs(2) function cannot distinguish between local and remote files and because of limitations in common network file systems (other than NFS).
Because these remote drives won't provide reproducible values for the inode number, the return values (generated by ftok(3) from the st_ino member of the stat structure) will not be reproducible.
msgget(2)
semget(2)
shmget(2)