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

  man pages->Tru64 Unix man pages -> ftok (3)              



NAME    [Toc]    [Back]

       ftok - Generate a standard interprocess communication key

SYNOPSIS    [Toc]    [Back]

       #include <sys/ipc.h>

       key_t ftok(
               const char *path_name,
               int project_id );

       The  following  definition of the ftok() function does not
       conform to current standards and  is  supported  only  for
       backward compatibility:

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

       key_t ftok(
               char *path_name,
               char project_id );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       ftok():  XPG4-UNIX

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  the pathname of an existing file that is accessible
 to the process.  Specifies  a  value  that  uniquely
       identifies a project.

DESCRIPTION    [Toc]    [Back]

       The  ftok() function returns a key, based on the path_name
       and project_id parameters, that is  usable  in  subsequent
       calls  to  the msgget(), semget(), and shmget() functions.
       The ftok() function returns the same  key  for  all  paths
       that  name  the  same file, when called with the same project_id
 parameter.  Different keys are  returned  for  the
       same  file if different project_id parameters are used, or
       if paths are used that name different  files  existing  on
       the  same file system at the same time. If a file named by
       path_name is removed and recreated with the same name, the
       ftok() function may return a different key than the original

       Only the low order 8-bits of project_id  are  significant.
       The behavior of ftok() is unspecified if these bits are 0.

       For maximum portability, project_id should  be  a  singlebyte

RETURN VALUES    [Toc]    [Back]

       Upon  successful completion, the ftok() function returns a
       key. Otherwise, ftok() returns  the  value  (key_t)-1  and
       sets errno to indicate the error.

ERRORS    [Toc]    [Back]

       The ftok() function sets errno to the specified values for
       the following conditions: Search permission is denied  for
       a component of the path_name parameter.  Too many symbolic
       links were encountered in resolving path_name.  The length
       of the path_name parameter exceeds PATH_MAX, or a pathname
       component is longer than NAME_MAX. Or, pathname resolution
       of  a  symbolic link produced an intermediate result whose
       length exceeds PATH_MAX.  The path_name  parameter  points
       to  the name of a file that does not exist or points to an
       empty string.  A component of the path_name  parameter  is
       not a directory.

SEE ALSO    [Toc]    [Back]

       Functions: msgget(2), semget(2), shmget(2)

       Standards: standards(5)

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