Penguin
Annotated edit history of ftok(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 FTOK
2 !!!FTOK
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 BUGS
8 SEE ALSO
9 ----
10 !!NAME
11
12
13 ftok - convert a pathname and a project identifier to a System V IPC key
14 !!SYNOPSIS
15
16
17 __# include
18 ____key_t ftok ( char *__''pathname''__, char__ ''proj'' __)__
19 !!DESCRIPTION
20
21
22 The function converts the pathname of an existing accessible
23 file and a project identifier into a __key_t__ type
24 System V IPC key.
25 !!RETURN VALUE
26
27
28 On success the return value will be the converted
29 __key_t__ value, otherwise __-1__ with __errno__
30 indicating the error as for the stat(2) system
31 call.
32 !!BUGS
33
34
35 The generated __key_t__ value is obtained __stat__-ing
36 the disk file corresponding to ''pathname'' in order to
37 get its i-node number and the minor device number of the
38 filesystem on which the disk file resides, then by combining
39 the 8 bit ''proj'' value along with the lower 16 bits of
40 the i-node number, along with the 8 bits of the minor device
41 number. The algorithm does not guarantee a unique key value.
42 In fact
43
44
45 Two different names linking to the same file produce same
46 key values.
47
48
49 Using the lower 16 bits of the i-node number, gives some
50 chance (also usually small) to have same key values for file
51 names referring to different i-nodes.
52
53
54 Not discriminating among major device numbers, gives some
55 chance of collision (also usually small) for systems with
56 multiple disk controllers.
57 !!SEE ALSO
58
59
60 ipc(5), msgget(2), semget(2),
61 shmget(2), stat(2)
62 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.