Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
ftok(3)
Edit
PageHistory
Diff
Info
LikePages
FTOK !!!FTOK NAME SYNOPSIS DESCRIPTION RETURN VALUE BUGS SEE ALSO ---- !!NAME ftok - convert a pathname and a project identifier to a System V IPC key !!SYNOPSIS __# include ____key_t ftok ( char *__''pathname''__, char__ ''proj'' __)__ !!DESCRIPTION The function converts the pathname of an existing accessible file and a project identifier into a __key_t__ type System V IPC key. !!RETURN VALUE On success the return value will be the converted __key_t__ value, otherwise __-1__ with __errno__ indicating the error as for the stat(2) system call. !!BUGS The generated __key_t__ value is obtained __stat__-ing the disk file corresponding to ''pathname'' in order to get its i-node number and the minor device number of the filesystem on which the disk file resides, then by combining the 8 bit ''proj'' value along with the lower 16 bits of the i-node number, along with the 8 bits of the minor device number. The algorithm does not guarantee a unique key value. In fact Two different names linking to the same file produce same key values. Using the lower 16 bits of the i-node number, gives some chance (also usually small) to have same key values for file names referring to different i-nodes. Not discriminating among major device numbers, gives some chance of collision (also usually small) for systems with multiple disk controllers. !!SEE ALSO ipc(5), msgget(2), semget(2), shmget(2), stat(2) ----
5 pages link to
ftok(3)
:
Man3f
ipc(5)
semget(2)
shmget(2)
msgget(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.