*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> stdipc (3c)              


stdipc(3C)							    stdipc(3C)

NAME    [Toc]    [Back]

     stdipc: ftok - standard interprocess communication	package

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/ipc.h>

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

DESCRIPTION    [Toc]    [Back]

     All interprocess communication facilities require the user	to supply a
     key to be used by the msgget(2), semget(2), and shmget(2) system calls to
     obtain interprocess communication identifiers.  One suggested method for
     forming a key is to use the ftok subroutine described below.  Another way
     to	compose	keys is	to include the project ID in the most significant byte
     and to use	the remaining portion as a sequence number.  There are many
     other ways	to form	keys, but it is	necessary for each system to define
     standards for forming them.  If some standard is not adhered to, it will
     be	possible for unrelated processes to unintentionally interfere with
     each other's operation.  It is still possible to interface	intentionally.
     Therefore,	it is strongly suggested that the most significant byte	of a
     key in some sense refer to	a project so that keys do not conflict across
     a given system.

     ftok returns a key	based on path and id that is usable in subsequent
     msgget, semget, and shmget	system calls.  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.  Note that ftok will return the same
     key for linked files when called with the same id and that	it will	return
     different keys when called	with the same file name	but different ids.

SEE ALSO    [Toc]    [Back]

     intro(2), msgget(2), semget(2), shmget(2).

DIAGNOSTICS    [Toc]    [Back]

     ftok returns (key_t) -1 if	path does not exist or if it is	not accessible
     to	the process.

NOTES    [Toc]    [Back]

     If	the file whose path is passed to ftok is removed when keys still refer
     to	the file, future calls to ftok with the	same path and id will return
     an	error.	If the same file is recreated, then ftok is likely to return a
     different key than	it did the original time it was	called.

									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
ftok Tru64 Generate a standard interprocess communication key
unix Linux Sockets for local interprocess communication.
ipc Linux System V interprocess communication mechanisms
ipcs Tru64 Reports Interprocess Communication (IPC) facility status
pipe OpenBSD create descriptor pair for interprocess communication
pipe NetBSD create descriptor pair for interprocess communication
ipcs HP-UX report status of interprocess communication facilities
pipe FreeBSD create descriptor pair for interprocess communication
ipcs FreeBSD report System V interprocess communication facilities status
ipcs OpenBSD report System V interprocess communication facilities status
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service