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

  man pages->Linux man pages -> ftok (3)              
Title
Content
Arch
Section
 

FTOK(3)

Contents


NAME    [Toc]    [Back]

       ftok  -	convert  a pathname and a project identifier to a System V IPC
       key

SYNOPSIS    [Toc]    [Back]

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

       key_t ftok ( char *pathname, char proj )

DESCRIPTION    [Toc]    [Back]

       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    [Toc]    [Back]

       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    [Toc]    [Back]

       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

       o      Two different names linking to the same file  produce  same  key
	      values.

       o      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.

       o      Not discriminating among major device numbers, gives some chance
	      of collision (also usually small) for systems with multiple disk
	      controllers.

SEE ALSO    [Toc]    [Back]

      
      
       ipc(5), msgget(2), semget(2), shmget(2), stat(2)



Linux 0.99.13			  1993-11-01			       FTOK(3)
[ Back ]
 Similar pages
Name OS Title
ftok OpenBSD create IPC identifier from a pathname
getuid IRIX convert from string to unique identifier
extattr_string_to_namespace OpenBSD convert an extended attribute namespace identifier to a string and vice versa
extattr_namespace_to_string OpenBSD convert an extended attribute namespace identifier to a string and vice versa
extattr_string_to_namespace FreeBSD convert an extended attribute namespace identifier to a string and vice versa
extattr FreeBSD convert an extended attribute namespace identifier to a string and vice versa
extattr OpenBSD convert an extended attribute namespace identifier to a string and vice versa
extattr_namespace_to_string FreeBSD convert an extended attribute namespace identifier to a string and vice versa
projid IRIX project name to project ID mapping file
vfs_getnewfsid FreeBSD allocate a new file system identifier
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service