ftok()

generate IPC key 

Function


SYNOPSIS

#include <sys/ipc.h>

key_t ftok(const char *path, int id);


DESCRIPTION

The ftok() function returns a key based on path and id. The function returns the same key for all paths that point to the same file when called with the same id value. If ftok() is called with different id values or path points to different files on the same file system, it returns different keys.


PARAMETERS

path 

Points to a path upon which part of the key is formed.

id 

Is the character upon which part of the key is formed.


RETURN VALUES

If successful, ftok() returns a unique key. On failure, it returns -1 and sets errno to one of the following values:

EACCES 

Search permission is denied for a component of the path prefix.

ENAMETOOLONG 

The length of the path argument exceeds PATH_MAX or a path name component is longer than NAME_MAX.

ENOENT 

A component of path does not name an existing file or path is an empty string.

ENOTDIR 

A component of the path prefix is not a directory.


CONFORMANCE

UNIX 98 with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Keys are only guaranteed to be unique for files on locally-mounted NTFS file systems.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
msgget(), semget(), shmget(), stat()


PTC MKS Toolkit 10.4 Documentation Build 39.