ftok(3C)ftok(3C)NAME
ftok() - create interprocess communication identifier
SYNOPSIS DESCRIPTION
All interprocess communication facilities require the user to supply a key to be used by the and system calls to obtain interprocess commu-
nication identifiers (see msgget(2), semget(2), and shmget(2)).
returns a key based on path and id that is usable in subsequent and system calls.
The parameters for the function are as follows:
path must be the path name of an existing file that is accessible to the process.
id is a character that uniquely identifies a project. This means that only the low order 8-bits of id are signifi-
cant. Note that returns the same key for linked files when called with the same id and that it returns differ-
ent keys when called with the same file name but different ids.
RETURN VALUE
returns if path does not exist or if it is not accessible to the process.
EXAMPLES
The following call to returns a key associated with the file myfile and id
WARNINGS
If the file whose path is passed to is removed when keys still refer to the file, future calls to with the same path and id will return an
error. If the same file is recreated, is likely to return a different key than it did the original time it was called.
SEE ALSO intro(2), msgget(2), semget(2), shmget(2), thread_safety(5).
ftok(3C)
Check Out this Related Man Page
FTOK(3) BSD Library Functions Manual FTOK(3)NAME
ftok -- create IPC identifier from path name
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
key_t
ftok(const char *path, int id);
DESCRIPTION
The ftok() function attempts to create a unique key suitable for use with the msgget(2), semget(2) and shmget(2) functions given the path of
an existing file and a user-selectable id.
The specified path must specify an existing file that is accessible to the calling process or the call will fail. Also, note that links to
files will return the same key, given the same id.
RETURN VALUES
The ftok() function will return -1 if path does not exist or if it cannot be accessed by the calling process.
SEE ALSO msgget(2), semget(2), shmget(2)HISTORY
The ftok() function originates with System V and is typically used by programs that use the System V IPC routines.
AUTHORS
Thorsten Lockert <tholo@sigmasoft.com>
BUGS
The returned key is computed based on the device minor number and inode of the specified path in combination with the lower 8 bits of the
given id. Thus it is quite possible for the routine to return duplicate keys.
BSD July 9, 2009 BSD
Hi,
I am having problem with msgget() function.
Here is the problem that I am having on Unix :
I have two processes sender and receiver. Sender generates queue (msgget()) with some key e.g. 938, for output.
Receiver reads from the same queue. i.e. receiver also tries to get queue... (2 Replies)
In emacs elisp, there is a handy function called file-name-nondirectory which accepts a path and file name and returns just a file name and extension. There is also a function called file-name-directory which just returns the dire ctory name without the file.
How can I implement these same... (2 Replies)
Is there some rule about using wildcards in path? Say I want to create a file, but one of the directories in the path is called 1433d.default and on different machines it will be called <some other string>.default
touch ~/Library/Application/*.default/myfile
In theory I thought that... (5 Replies)
In the system call msgget(key,mode) for the argument key i want to use ftok call . I am really confused with the argument pathname in ftok call. I want to know the pathname of which file I want to specify over there. I am just a beginer to advanced unix plz help me out. (1 Reply)