1 .\" $NetBSD: ftok.3,v 1.14 2009/03/09 19:24:26 joerg Exp $
3 .\" Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 .Nd create IPC identifier from path name
38 .Fn ftok "const char *path" "int id"
42 function attempts to create a unique key suitable for use with the
49 of an existing file and a user-selectable
54 must specify an existing file that is accessible to the calling process
55 or the call will fail.
56 Also, note that links to files will return the same key, given the same
59 Only the 8 least significant bits of
61 are used in the key generation; the rest of the bits are ignored.
65 function will return ((key_t)-1) if
67 does not exist or if it cannot be accessed by the calling process.
75 function originated with System V and is typically used by programs
76 that use the System V IPC routines.
78 .An Thorsten Lockert Aq tholo@sigmasoft.com
80 The returned key is computed based on the device and inode of the
83 in combination with the given
85 Thus it is quite possible for the routine to return duplicate keys
86 given that those fields are not 8- and 16-bit quantities like they
87 were on System V based systems where this library routine's ancestor
88 were originally created.