Index of Section 3 Manual Pages

Interix / SUAftok.3Interix / SUA

ftok(3)                                                         ftok(3)

  ftok()

  NAME

    ftok() - Create key for IPC facilities.

  SYNOPSIS

    #include 

    key_t ftok(const char *path, int id)

  DESCRIPTION

    The ftok(3) call creates a key to be used by interprocess communication
    facilities (IPC). The key is created based on the path and id that can be
    used in subsequent calls to msgget(2), semget(2), and shmget(2).

    The path must be the pathname of an existing file that the process can
    access. If the same file can be referred to by different path names (for
    instance, relative paths), all paths that refer to the same file will
    result in the same key.

    The id is a character that uniquely identifies a particular project. If
    the low order 8 bits of id are 0, behavior is unspecified.

  RETURN VALUES

    The ftok(3) call returns a key if it succeeds. Otherwise it returns -1 and
    sets errno to indicate the error.

  ERRORS

    The ftok(3) function can fail for the following reasons:

    [EACCES]
        The process did not have permission to searfch a component of the path
        prefix.

    [ELOOP]
        Too many symbolic links were encountered in translating the pathname.

    [ENAMETOOLONG]
        The path argument was longer than {PATH_MAX} or a component was longer
        than {NAME_MAX}.

    [ENOENT]
        Some component of path doesn't exist or path is an empty string.

    [ENOTDIR]
        Some component of the path prefix is not a directory.

  NOTES

    This implementation of ftok(3) cannot distinguish between local and
    network drives, because the statvfs(2) function cannot distinguish between
    local and remote files and because of limitations in common network file
    systems (other than NFS).

    Because these remote drives won't provide reproducible values for the
    inode number, the return values (generated by ftok(3) from the st_ino
    member of the stat structure) will not be reproducible.

  SEE ALSO

    msgget(2)

    semget(2)

    shmget(2)

  USAGE NOTES

    The ftok function is thread safe.

    The ftok function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA